Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: content/browser/plugin_service_impl.cc

Issue 103623003: Instrument pepper plugin load failures. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/plugin_service_impl.h" 5 #include "content/browser/plugin_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 // Record when NPAPI Flash process is started for the first time. 293 // Record when NPAPI Flash process is started for the first time.
294 static bool counted = false; 294 static bool counted = false;
295 if (!counted && UTF16ToUTF8(info.name) == kFlashPluginName) { 295 if (!counted && UTF16ToUTF8(info.name) == kFlashPluginName) {
296 counted = true; 296 counted = true;
297 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage", 297 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage",
298 START_NPAPI_FLASH_AT_LEAST_ONCE, 298 START_NPAPI_FLASH_AT_LEAST_ONCE,
299 FLASH_USAGE_ENUM_COUNT); 299 FLASH_USAGE_ENUM_COUNT);
300 } 300 }
301 301 #if defined(OS_CHROMEOS)
302 // TODO(ihf): Move to an earlier place once crbug.com/314301 is fixed. For now
303 // we still want Plugin.FlashUsage recorded if we end up here.
304 LOG(WARNING) << "Refusing to start npapi plugin on ChromeOS.";
305 return NULL;
306 #endif
302 // This plugin isn't loaded by any plugin process, so create a new process. 307 // This plugin isn't loaded by any plugin process, so create a new process.
303 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost()); 308 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost());
304 if (!new_host->Init(info)) { 309 if (!new_host->Init(info)) {
305 NOTREACHED(); // Init is not expected to fail. 310 NOTREACHED(); // Init is not expected to fail.
306 return NULL; 311 return NULL;
307 } 312 }
308 return new_host.release(); 313 return new_host.release();
309 } 314 }
310 315
311 PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess( 316 PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess(
312 int render_process_id, 317 int render_process_id,
313 const base::FilePath& plugin_path, 318 const base::FilePath& plugin_path,
314 const base::FilePath& profile_data_directory) { 319 const base::FilePath& profile_data_directory) {
315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
316 321
317 if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) 322 if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) {
323 VLOG(1) << "Unable to load ppapi plugin: " << plugin_path.MaybeAsASCII();
318 return NULL; 324 return NULL;
325 }
319 326
320 PpapiPluginProcessHost* plugin_host = 327 PpapiPluginProcessHost* plugin_host =
321 FindPpapiPluginProcess(plugin_path, profile_data_directory); 328 FindPpapiPluginProcess(plugin_path, profile_data_directory);
322 if (plugin_host) 329 if (plugin_host)
323 return plugin_host; 330 return plugin_host;
324 331
325 // Validate that the plugin is actually registered. 332 // Validate that the plugin is actually registered.
326 PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); 333 PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
327 if (!info) 334 if (!info) {
335 VLOG(1) << "Unable to find ppapi plugin registration for: "
336 << plugin_path.MaybeAsASCII();
328 return NULL; 337 return NULL;
338 }
329 339
330 // Record when PPAPI Flash process is started for the first time. 340 // Record when PPAPI Flash process is started for the first time.
331 static bool counted = false; 341 static bool counted = false;
332 if (!counted && info->name == kFlashPluginName) { 342 if (!counted && info->name == kFlashPluginName) {
333 counted = true; 343 counted = true;
334 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage", 344 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage",
335 START_PPAPI_FLASH_AT_LEAST_ONCE, 345 START_PPAPI_FLASH_AT_LEAST_ONCE,
336 FLASH_USAGE_ENUM_COUNT); 346 FLASH_USAGE_ENUM_COUNT);
337 } 347 }
338 348
339 // This plugin isn't loaded by any plugin process, so create a new process. 349 // This plugin isn't loaded by any plugin process, so create a new process.
340 return PpapiPluginProcessHost::CreatePluginHost( 350 plugin_host = PpapiPluginProcessHost::CreatePluginHost(
341 *info, profile_data_directory); 351 *info, profile_data_directory);
352 if (!plugin_host) {
353 VLOG(1) << "Unable to create ppapi plugin process for: "
354 << plugin_path.MaybeAsASCII();
355 }
356
357 return plugin_host;
342 } 358 }
343 359
344 PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess( 360 PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess(
345 int render_process_id, 361 int render_process_id,
346 const base::FilePath& plugin_path) { 362 const base::FilePath& plugin_path) {
347 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
348 364
349 if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) 365 if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
350 return NULL; 366 return NULL;
351 367
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 window, kPluginVersionAtomProperty, plugin_version); 835 window, kPluginVersionAtomProperty, plugin_version);
820 return true; 836 return true;
821 } 837 }
822 838
823 bool PluginServiceImpl::IsPluginWindow(HWND window) { 839 bool PluginServiceImpl::IsPluginWindow(HWND window) {
824 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); 840 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName);
825 } 841 }
826 #endif 842 #endif
827 843
828 } // namespace content 844 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698