Chromium Code Reviews| Index: content/ppapi_plugin/ppapi_thread.cc |
| diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc |
| index ea7431378aa124a1247a55ab2f098f31cbb209c3..023f045e29f3e73e0a51d90539b8bcb99fb08a08 100644 |
| --- a/content/ppapi_plugin/ppapi_thread.cc |
| +++ b/content/ppapi_plugin/ppapi_thread.cc |
| @@ -269,12 +269,16 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path, |
| base::ScopedNativeLibrary library; |
| if (plugin_entry_points_.initialize_module == NULL) { |
| // Load the plugin from the specified library. |
| - std::string error; |
| - library.Reset(base::LoadNativeLibrary(path, &error)); |
| + std::string error_message; |
| + uint32 error_code = 0; |
| + library.Reset(base::LoadNativeLibrary(path, &error_message, &error_code)); |
| if (!library.is_valid()) { |
| LOG(ERROR) << "Failed to load Pepper module from " |
| - << path.value() << " (error: " << error << ")"; |
| + << path.value() << " (error: " << error_message << " with error code " |
|
ddorwin
2014/03/20 22:01:12
nit: You could also do something like "error 'code
xhwang
2014/03/21 01:42:58
Done.
|
| + << error_code << ")"; |
| ReportLoadResult(path, LOAD_FAILED); |
| + // Report detailed reason for load failure. |
| + ReportLoadErrorCode(path, error_code); |
| return; |
| } |
| @@ -519,4 +523,25 @@ void PpapiThread::ReportLoadResult(const base::FilePath& path, |
| histogram->Add(result); |
| } |
| +void PpapiThread::ReportLoadErrorCode(const base::FilePath& path, |
| + uint32 error_code) { |
| + // See http://msdn.microsoft.com/en-us/library/ms681381.aspx |
|
ddorwin
2014/03/20 22:01:12
This is based on only Win reporting an error code.
xhwang
2014/03/21 01:42:58
Not required since we use sparse histogram.
|
| + static const uint32 kMaxLoadErrorCode = 16000; |
| + |
| + std::ostringstream histogram_name; |
| + histogram_name << "Plugin.Ppapi" << (is_broker_ ? "Broker" : "Plugin") |
| + << "LoadErrorCode_" << path.BaseName().MaybeAsASCII(); |
| + |
| + // Note: This leaks memory, which is expected behavior. |
| + base::HistogramBase* histogram = |
| + base::LinearHistogram::FactoryGet( |
|
ddorwin
2014/03/20 22:01:12
Should this be sparse?
xhwang
2014/03/21 01:42:58
Good point. Done.
|
| + histogram_name.str(), |
| + 1, |
| + kMaxLoadErrorCode, |
| + kMaxLoadErrorCode + 1, |
| + base::HistogramBase::kUmaTargetedHistogramFlag); |
| + |
| + histogram->Add(error_code); |
| +} |
| + |
| } // namespace content |