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

Unified Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 13548005: Add UMA reporting on failure to load ppapi plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Report from PpapiThread. Created 7 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/ppapi_plugin/ppapi_thread.cc
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 0f718af44edd5edda20a78326bc4208c91d785ab..10dd0f58b762f96907866023f82d7d73032e0eb1 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,11 +355,13 @@ 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.
+ ReportLoadResult(path, LOAD_SUCCESS);
ddorwin 2013/04/15 20:34:36 Since the comment above applies to the next line,
xhwang 2013/04/15 20:53:19 Done.
library_.Reset(library.Release());
}
@@ -459,7 +468,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 +476,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." << (is_broker_ ? "Broker" : "Plugin")
ddorwin 2013/04/15 20:34:36 Plugin.Plugin.? How about Ppapi.Plugin/Broker? (Or
xhwang 2013/04/15 20:53:19 "Plugin" is the group name for all plugin related
+ << "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
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698