diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-12 21:41:59 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-12 21:41:59 +0000 |
commit | 64da00ef5f1126641356ec7a137c569793db004f (patch) | |
tree | 029aac661fa98bef5f5aa64bd84a7f897ac5e1eb | |
parent | df8a7a360b3454d8b71071d3972fc8694734b80c (diff) | |
download | chromium_src-64da00ef5f1126641356ec7a137c569793db004f.zip chromium_src-64da00ef5f1126641356ec7a137c569793db004f.tar.gz chromium_src-64da00ef5f1126641356ec7a137c569793db004f.tar.bz2 |
Set the number of views using the crash key logging system.
BUG=77656
Review URL: https://chromiumcodereview.appspot.com/23868022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222874 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/breakpad_linux.cc | 11 | ||||
-rw-r--r-- | chrome/app/breakpad_win.cc | 26 | ||||
-rw-r--r-- | chrome/common/child_process_logging.h | 4 | ||||
-rw-r--r-- | chrome/common/child_process_logging_mac.mm | 12 | ||||
-rw-r--r-- | chrome/common/child_process_logging_posix.cc | 5 | ||||
-rw-r--r-- | chrome/common/child_process_logging_win.cc | 19 | ||||
-rw-r--r-- | chrome/common/crash_keys.cc | 3 | ||||
-rw-r--r-- | chrome/common/crash_keys.h | 3 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 6 |
9 files changed, 15 insertions, 74 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc index 2652738..68fef27 100644 --- a/chrome/app/breakpad_linux.cc +++ b/chrome/app/breakpad_linux.cc @@ -1162,11 +1162,6 @@ void HandleCrashDump(const BreakpadInfo& info) { // beta \r\n // BOUNDARY \r\n // - // zero or one: - // Content-Disposition: form-data; name="num-views" \r\n \r\n - // 3 \r\n - // BOUNDARY \r\n - // // zero to 4: // Content-Disposition: form-data; name="prn-info-1" \r\n \r\n // abcdefghijklmnopqrstuvwxyzabcdef \r\n @@ -1295,12 +1290,6 @@ void HandleCrashDump(const BreakpadInfo& info) { writer.Flush(); } - if (*child_process_logging::g_num_views) { - writer.AddPairString("num-views", child_process_logging::g_num_views); - writer.AddBoundary(); - writer.Flush(); - } - unsigned printer_info_len = my_strlen(child_process_logging::g_printer_info); if (printer_info_len) { diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index b77b368..6a7f9f8 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -104,7 +104,6 @@ char* g_real_terminate_process_stub = NULL; static size_t g_client_id_offset = 0; static size_t g_printer_info_offset = 0; -static size_t g_num_of_views_offset = 0; static size_t g_num_switches_offset = 0; static size_t g_switches_offset = 0; static size_t g_dynamic_keys_offset = 0; @@ -477,21 +476,11 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, CommandLine::ForCurrentProcess()->argv(), &switches); SetCommandLine2(&switches[0], switches.size()); - if (type == L"renderer" || type == L"plugin" || type == L"ppapi" || - type == L"gpu-process") { - g_num_of_views_offset = g_custom_entries->size(); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"num-views", L"")); - - if (type == L"plugin" || type == L"ppapi") { - std::wstring plugin_path = - CommandLine::ForCurrentProcess()->GetSwitchValueNative("plugin-path"); - if (!plugin_path.empty()) - SetPluginPath(plugin_path); - } - } else { - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"num-views", L"N/A")); + if (type == L"plugin" || type == L"ppapi") { + std::wstring plugin_path = + CommandLine::ForCurrentProcess()->GetSwitchValueNative("plugin-path"); + if (!plugin_path.empty()) + SetPluginPath(plugin_path); } // Check whether configuration management controls crash reporting. @@ -655,11 +644,6 @@ extern "C" void __declspec(dllexport) __cdecl SetPrinterInfo( } } -extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews( - int number_of_views) { - SetIntegerValue(g_num_of_views_offset, number_of_views); -} - // NOTE: This function is used by SyzyASAN to annotate crash reports. If you // change the name or signature of this function you will break SyzyASAN // instrumented releases of Chrome. Please contact syzygy-team@chromium.org diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index fe4d969a..1bc62e7 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -44,7 +44,6 @@ extern char g_channel[]; extern char g_client_id[]; extern char g_num_switches[]; extern char g_num_variations[]; -extern char g_num_views[]; extern char g_printer_info[]; extern char g_switches[]; extern char g_variation_chunks[]; @@ -63,9 +62,6 @@ void SetClientId(const std::string& client_id); // id in |client_id| if it's known, an empty string otherwise. std::string GetClientId(); -// Sets a number of views/tabs opened in this process. -void SetNumberOfViews(int number_of_views); - // Sets the data on the printer to send along with crash reports. Data may be // separated by ';' up to kMaxReportedPrinterRecords strings. Each substring // would be cut to 63 chars. diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index eac57dc..2e1abd2 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -7,7 +7,6 @@ #import <Foundation/Foundation.h> #include "base/command_line.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -24,7 +23,6 @@ using base::debug::SetCrashKeyValue; using base::debug::ClearCrashKey; const char* kGuidParamName = "guid"; -const char* kNumberOfViews = "num-views"; const char* kPrinterInfoNameFormat = "prn-info-%zu"; // Account for the terminating null character. @@ -65,16 +63,6 @@ void SetPrinterInfo(const char* printer_info) { } } -void SetNumberOfViewsImpl(int number_of_views, - SetCrashKeyValueFuncT set_key_func) { - std::string value = base::IntToString(number_of_views); - set_key_func(kNumberOfViews, value); -} - -void SetNumberOfViews(int number_of_views) { - SetNumberOfViewsImpl(number_of_views, SetCrashKeyValue); -} - void SetCommandLine(const CommandLine* command_line) { DCHECK(command_line); if (!command_line) diff --git a/chrome/common/child_process_logging_posix.cc b/chrome/common/child_process_logging_posix.cc index 53f86ab..9b9b5b51 100644 --- a/chrome/common/child_process_logging_posix.cc +++ b/chrome/common/child_process_logging_posix.cc @@ -31,7 +31,6 @@ char g_printer_info[kPrinterInfoStrLen * kMaxReportedPrinterRecords + 1] = ""; static const size_t kNumSize = 32; char g_num_switches[kNumSize] = ""; char g_num_variations[kNumSize] = ""; -char g_num_views[kNumSize] = ""; // Assume command line switches are less than 64 chars. static const size_t kMaxSwitchesSize = kSwitchLen * kMaxSwitches + 1; @@ -71,10 +70,6 @@ void SetPrinterInfo(const char* printer_info) { arraysize(g_printer_info)); } -void SetNumberOfViews(int number_of_views) { - snprintf(g_num_views, arraysize(g_num_views), "%d", number_of_views); -} - void SetCommandLine(const CommandLine* command_line) { const CommandLine::StringVector& argv = command_line->argv(); diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index c94b3cc..c7cd7ac 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -27,10 +27,6 @@ typedef void (__cdecl *MainSetClientId)(const wchar_t*); typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); // exported in breakpad_win.cc: -// void __declspec(dllexport) __cdecl SetNumberOfViews. -typedef void (__cdecl *MainSetNumberOfViews)(int); - -// exported in breakpad_win.cc: // void __declspec(dllexport) __cdecl SetCommandLine2 typedef void (__cdecl *MainSetCommandLine)(const wchar_t**, size_t); @@ -158,21 +154,6 @@ void SetExperimentList(const std::vector<string16>& experiments) { (set_experiment_list)(&cstrings[0], cstrings.size(), experiments.size()); } -void SetNumberOfViews(int number_of_views) { - static MainSetNumberOfViews set_number_of_views = NULL; - // note: benign race condition on set_number_of_views. - if (!set_number_of_views) { - HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); - if (!exe_module) - return; - set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( - GetProcAddress(exe_module, "SetNumberOfViews")); - if (!set_number_of_views) - return; - } - (set_number_of_views)(number_of_views); -} - namespace { void SetCrashKeyValueTrampoline(const base::StringPiece& key, diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc index 10d2d57..7cd6132 100644 --- a/chrome/common/crash_keys.cc +++ b/chrome/common/crash_keys.cc @@ -53,6 +53,8 @@ const char kActiveURL[] = "url-chunk"; const char kExtensionID[] = "extension-%" PRIuS; const char kNumExtensionsCount[] = "num-extensions"; +const char kNumberOfViews[] = "num-views"; + #if !defined(OS_ANDROID) const char kGPUVendorID[] = "gpu-venid"; const char kGPUDeviceID[] = "gpu-devid"; @@ -93,6 +95,7 @@ size_t RegisterChromeCrashKeys() { base::debug::CrashKey fixed_keys[] = { { kActiveURL, kLargeSize }, { kNumExtensionsCount, kSmallSize }, + { kNumberOfViews, kSmallSize }, #if !defined(OS_ANDROID) { kGPUVendorID, kSmallSize }, { kGPUDeviceID, kSmallSize }, diff --git a/chrome/common/crash_keys.h b/chrome/common/crash_keys.h index 0054011..42e4d40 100644 --- a/chrome/common/crash_keys.h +++ b/chrome/common/crash_keys.h @@ -38,6 +38,9 @@ extern const char kExtensionID[]; // a common->app dependency. extern const char kNumExtensionsCount[]; +// The number of render views/tabs open in a renderer process. +extern const char kNumberOfViews[]; + // GPU information. #if !defined(OS_ANDROID) extern const char kGPUVendorID[]; diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 7f4bfe2..6d5f688 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -5,6 +5,7 @@ #include "chrome/renderer/chrome_content_renderer_client.h" #include "base/command_line.h" +#include "base/debug/crash_logging.h" #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/path_service.h" @@ -12,11 +13,11 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" +#include "chrome/common/crash_keys.h" #include "chrome/common/extensions/chrome_extensions_client.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -392,7 +393,8 @@ void ChromeContentRendererClient::RenderViewCreated( } void ChromeContentRendererClient::SetNumberOfViews(int number_of_views) { - child_process_logging::SetNumberOfViews(number_of_views); + base::debug::SetCrashKeyValue(crash_keys::kNumberOfViews, + base::IntToString(number_of_views)); } SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() { |