summaryrefslogtreecommitdiffstats
path: root/content/ppapi_plugin/ppapi_thread.cc
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-17 00:09:59 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-17 00:09:59 +0000
commitef3304a19de0414d511b757879380259dab6022e (patch)
tree331f8ff60f43e6d045ced11501213ab796a2ca38 /content/ppapi_plugin/ppapi_thread.cc
parentdc86957249846fe4420f335933a94b83fb8ee349 (diff)
downloadchromium_src-ef3304a19de0414d511b757879380259dab6022e.zip
chromium_src-ef3304a19de0414d511b757879380259dab6022e.tar.gz
chromium_src-ef3304a19de0414d511b757879380259dab6022e.tar.bz2
Add UMA reporting on failure to load ppapi plugins.
The UMA histogram name is appended with library names. Since we only have limited number of ppapi plugins this shouldn't be an issue for the server to handle. BUG=226107 TEST=Tested Widevine CDM loading. Review URL: https://codereview.chromium.org/13548005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin/ppapi_thread.cc')
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 0f718af..006f28c 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/stringprintf.h"
@@ -259,6 +260,7 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
if (!library.is_valid()) {
LOG(ERROR) << "Failed to load Pepper module from "
<< path.value() << " (error: " << error << ")";
+ ReportLoadResult(path, LOAD_FAILED);
return;
}
@@ -268,6 +270,7 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
library.GetFunctionPointer("PPP_GetInterface"));
if (!plugin_entry_points_.get_interface) {
LOG(WARNING) << "No PPP_GetInterface in plugin library";
+ ReportLoadResult(path, ENTRY_POINT_MISSING);
return;
}
@@ -286,6 +289,7 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
library.GetFunctionPointer("PPP_InitializeModule"));
if (!plugin_entry_points_.initialize_module) {
LOG(WARNING) << "No PPP_InitializeModule in plugin library";
+ ReportLoadResult(path, ENTRY_POINT_MISSING);
return;
}
}
@@ -323,16 +327,19 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
library.GetFunctionPointer("PPP_InitializeBroker"));
if (!init_broker) {
LOG(WARNING) << "No PPP_InitializeBroker in plugin library";
+ ReportLoadResult(path, ENTRY_POINT_MISSING);
return;
}
int32_t init_error = init_broker(&connect_instance_func_);
if (init_error != PP_OK) {
LOG(WARNING) << "InitBroker failed with error " << init_error;
+ ReportLoadResult(path, INIT_FAILED);
return;
}
if (!connect_instance_func_) {
LOG(WARNING) << "InitBroker did not provide PP_ConnectInstance_Func";
+ ReportLoadResult(path, INIT_FAILED);
return;
}
} else {
@@ -348,12 +355,15 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
&ppapi::proxy::PluginDispatcher::GetBrowserInterface);
if (init_error != PP_OK) {
LOG(WARNING) << "InitModule failed with error " << init_error;
+ ReportLoadResult(path, INIT_FAILED);
return;
}
}
// Initialization succeeded, so keep the plugin DLL loaded.
library_.Reset(library.Release());
+
+ ReportLoadResult(path, LOAD_SUCCESS);
}
void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid,
@@ -459,7 +469,7 @@ void PpapiThread::SavePluginName(const base::FilePath& path) {
ppapi::proxy::PluginGlobals::Get()->set_plugin_name(
path.BaseName().AsUTF8Unsafe());
- // plugin() is NULL when in-process. Which is fine, because this is
+ // plugin() is NULL when in-process, which is fine, because this is
// just a hook for setting the process name.
if (GetContentClient()->plugin()) {
GetContentClient()->plugin()->PluginProcessStarted(
@@ -467,4 +477,24 @@ void PpapiThread::SavePluginName(const base::FilePath& path) {
}
}
+void PpapiThread::ReportLoadResult(const base::FilePath& path,
+ LoadResult result) {
+ DCHECK_LT(result, LOAD_RESULT_MAX);
+
+ std::ostringstream histogram_name;
+ histogram_name << "Plugin.Ppapi" << (is_broker_ ? "Broker" : "Plugin")
+ << "LoadResult_" << path.BaseName().MaybeAsASCII();
+
+ // Note: This leaks memory, which is expected behavior.
+ base::HistogramBase* histogram =
+ base::LinearHistogram::FactoryGet(
+ histogram_name.str(),
+ 1,
+ LOAD_RESULT_MAX,
+ LOAD_RESULT_MAX + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+
+ histogram->Add(result);
+}
+
} // namespace content