Instrument pepper plugin load failures.

ChromeOS experiences an increased failure to load Pepper Flash plugins.
To help investigate these failures in the field increase logging.
Also disallow npapi plugin generation on ChromeOS as a fallback. We
don't need a zombie process when this failure happens.

BUG=chromium:314301
TEST=kill -stop, reload, kill -9 ppapi process on Pixel.

Review URL: https://codereview.chromium.org/103623003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239740 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index b0153d9..74feede 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -298,7 +298,12 @@
                               START_NPAPI_FLASH_AT_LEAST_ONCE,
                               FLASH_USAGE_ENUM_COUNT);
   }
-
+#if defined(OS_CHROMEOS)
+  // TODO(ihf): Move to an earlier place once crbug.com/314301 is fixed. For now
+  // we still want Plugin.FlashUsage recorded if we end up here.
+  LOG(WARNING) << "Refusing to start npapi plugin on ChromeOS.";
+  return NULL;
+#endif
   // This plugin isn't loaded by any plugin process, so create a new process.
   scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost());
   if (!new_host->Init(info)) {
@@ -314,8 +319,10 @@
     const base::FilePath& profile_data_directory) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
 
-  if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
+  if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) {
+    VLOG(1) << "Unable to load ppapi plugin: " << plugin_path.MaybeAsASCII();
     return NULL;
+  }
 
   PpapiPluginProcessHost* plugin_host =
       FindPpapiPluginProcess(plugin_path, profile_data_directory);
@@ -324,8 +331,11 @@
 
   // Validate that the plugin is actually registered.
   PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path);
-  if (!info)
+  if (!info) {
+    VLOG(1) << "Unable to find ppapi plugin registration for: "
+            << plugin_path.MaybeAsASCII();
     return NULL;
+  }
 
   // Record when PPAPI Flash process is started for the first time.
   static bool counted = false;
@@ -337,8 +347,14 @@
   }
 
   // This plugin isn't loaded by any plugin process, so create a new process.
-  return PpapiPluginProcessHost::CreatePluginHost(
+  plugin_host = PpapiPluginProcessHost::CreatePluginHost(
       *info, profile_data_directory);
+  if (!plugin_host) {
+    VLOG(1) << "Unable to create ppapi plugin process for: "
+            << plugin_path.MaybeAsASCII();
+  }
+
+  return plugin_host;
 }
 
 PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess(