From 77bf9602e04a630c2590204d2317e5e6fd7ffefd Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Thu, 11 Nov 2010 00:37:59 +0000 Subject: [Mac] Log extensions loaded with crash dumps. Replacing the TODO(port) to log extension-N for the extensions associated with a dump. CL which landed TODO(port): http://codereview.chromium.org/457028 BUG=none TEST=none Review URL: http://codereview.chromium.org/4645005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65743 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/child_process_logging.h | 2 +- chrome/common/child_process_logging_mac.mm | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'chrome/common') diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index bcc5ecd..4c4343c 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -14,7 +14,7 @@ class GPUInfo; -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_MACOSX) // The maximum number of active extensions we will report. // Also used in chrome/app, but we define it here to avoid a common->app // dependency. diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index a61202c..ca12d1c 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -26,6 +26,8 @@ const char *kGPUPixelShaderVersionParamName = "gpu-psver"; const char *kGPUVertexShaderVersionParamName = "gpu-vsver"; const char *kGPUGLVersionParamName = "gpu-glver"; const char *kNumberOfViews = "num-views"; +NSString* const kNumExtensionsName = @"num-extensions"; +NSString* const kExtensionNameFormat = @"extension-%d"; static SetCrashKeyValueFuncPtr g_set_key_func; static ClearCrashKeyValueFuncPtr g_clear_key_func; @@ -112,7 +114,25 @@ std::string GetClientId() { } void SetActiveExtensions(const std::set& extension_ids) { - // TODO(port) + if (!g_set_key_func) + return; + + // Log the count separately to track heavy users. + const int count = static_cast(extension_ids.size()); + g_set_key_func(kNumExtensionsName, [NSString stringWithFormat:@"%i", count]); + + // Record up to |kMaxReportedActiveExtensions| extensions, clearing + // keys if there aren't that many. + std::set::const_iterator iter = extension_ids.begin(); + for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { + NSString* key = [NSString stringWithFormat:kExtensionNameFormat, i]; + if (iter != extension_ids.end()) { + g_set_key_func(key, [NSString stringWithUTF8String:iter->c_str()]); + ++iter; + } else { + g_clear_key_func(key); + } + } } void SetGpuKeyValue(const char* param_name, const std::string& value_str, -- cgit v1.1