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

Side by Side Diff: chrome/plugin/chrome_content_plugin_client.cc

Issue 13548005: Add UMA reporting on failure to load ppapi plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also report loading error for flash. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/chrome_content_plugin_client.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/metrics/histogram.h"
6 #include "chrome/common/chrome_constants.h"
5 #include "chrome/plugin/chrome_content_plugin_client.h" 7 #include "chrome/plugin/chrome_content_plugin_client.h"
8 #include "third_party/widevine/cdm/widevine_cdm_common.h"
6 9
7 #if defined(ENABLE_REMOTING) 10 #if defined(ENABLE_REMOTING)
8 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
9 #include "base/path_service.h" 12 #include "base/path_service.h"
10 #include "content/public/common/content_paths.h" 13 #include "content/public/common/content_paths.h"
11 #include "media/base/media.h" 14 #include "media/base/media.h"
12 #if defined(OS_WIN) 15 #if defined(OS_WIN)
13 #include "base/logging.h" 16 #include "base/logging.h"
14 #include "base/native_library.h" 17 #include "base/native_library.h"
15 #elif defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS) 18 #elif defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS)
16 #include "crypto/nss_util.h" 19 #include "crypto/nss_util.h"
17 #endif 20 #endif // defined(OS_WIN)
18 #endif 21 #endif // defined(ENABLE_REMOTING)
19 22
20 #if defined(OS_MACOSX) 23 #if defined(OS_MACOSX)
21 #include "base/mac/mac_util.h" 24 #include "base/mac/mac_util.h"
22 #include "base/mac/scoped_cftyperef.h" 25 #include "base/mac/scoped_cftyperef.h"
23 #include "base/strings/sys_string_conversions.h" 26 #include "base/strings/sys_string_conversions.h"
24 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
25 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
26 #endif 29 #endif // defined(OS_MACOSX)
27 30
28 namespace chrome { 31 namespace chrome {
29 32
30 void ChromeContentPluginClient::PreSandboxInitialization() { 33 void ChromeContentPluginClient::PreSandboxInitialization() {
31 #if defined(ENABLE_REMOTING) 34 #if defined(ENABLE_REMOTING)
32 35
33 // Load crypto libraries for the Chromoting client plugin. 36 // Load crypto libraries for the Chromoting client plugin.
34 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS) 37 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS)
35 // On platforms where we use system NSS libraries, the .so's must be loaded 38 // On platforms where we use system NSS libraries, the .so's must be loaded
36 // before the sandbox is initialized. 39 // before the sandbox is initialized.
(...skipping 23 matching lines...) Expand all
60 base::mac::ScopedCFTypeRef<CFStringRef> app_name( 63 base::mac::ScopedCFTypeRef<CFStringRef> app_name(
61 base::SysUTF16ToCFStringRef( 64 base::SysUTF16ToCFStringRef(
62 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); 65 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
63 base::mac::ScopedCFTypeRef<CFStringRef> process_name( 66 base::mac::ScopedCFTypeRef<CFStringRef> process_name(
64 CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"), 67 CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
65 cf_plugin_name.get(), app_name.get())); 68 cf_plugin_name.get(), app_name.get()));
66 base::mac::SetProcessName(process_name); 69 base::mac::SetProcessName(process_name);
67 #endif 70 #endif
68 } 71 }
69 72
73 // Reports plugin loading result through UMA. This macro can only be called
74 // in function PluginLoaded.
75 // |name| must be const string based on how UMA_HISTOGRAM_ENUMERATION works.
ddorwin 2013/04/09 01:44:11 You should also explain why this must be a macro f
xhwang 2013/04/09 03:59:42 Use FactoryGet following Ilya's suggestion as we d
76 #define REPORT_PLUGIN_LOAD_UMA(name) \
77 do { \
78 if (!is_broker) { \
Ilya Sherman 2013/04/09 01:49:22 For readability's sake, please pass is_broker in a
xhwang 2013/04/09 03:59:42 Done.
79 UMA_HISTOGRAM_ENUMERATION("Plugin.PluginLoadResult."name, result, \
80 ContentPluginClient::LOAD_STATUS_MAX); \
81 } else { \
82 UMA_HISTOGRAM_ENUMERATION("Plugin.BrokerLoadResult."name, result, \
83 ContentPluginClient::LOAD_STATUS_MAX); \
84 } \
85 } while (0);
Ilya Sherman 2013/04/09 01:49:22 This is ok, but IMO it'd be cleaner to write a fun
xhwang 2013/04/09 03:59:42 Thanks! This is much better!
86
87 void ChromeContentPluginClient::PluginLoaded(const base::FilePath& plugin_path,
88 bool is_broker,
89 PluginLoadResult result) {
90 base::FilePath::StringType plugin_name = plugin_path.BaseName().value();
91 if (plugin_name == kPepperFlashPluginFilename) {
92 REPORT_PLUGIN_LOAD_UMA("PepperFlash");
ddorwin 2013/04/09 01:44:11 pass result into your macro as if it was a functio
xhwang 2013/04/09 03:59:42 Done.
93 } else if (plugin_name == kWidevineCdmPluginFileName) {
94 REPORT_PLUGIN_LOAD_UMA("WidevineCDM");
95 }
96 }
97
70 } // namespace chrome 98 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/plugin/chrome_content_plugin_client.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698