From 80ddb0445a0ac70b0d7dfc92c51e052b54a9ef18 Mon Sep 17 00:00:00 2001 From: "antonm@chromium.org" Date: Tue, 5 Oct 2010 13:50:06 +0000 Subject: Dump total number of extensions into crash dump meta data. Review URL: http://codereview.chromium.org/3520015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61509 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/breakpad_win.cc | 26 ++++++++++++++++++++------ chrome/common/child_process_logging_win.cc | 17 +++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'chrome') diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index 5f31438..5d57166 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -66,6 +66,7 @@ google_breakpad::ExceptionHandler* g_breakpad = NULL; // data updated as the state of the browser changes. static std::vector* g_custom_entries = NULL; static size_t g_url_chunks_offset; +static size_t g_num_of_extensions_offset; static size_t g_extension_ids_offset; static size_t g_client_id_offset; static size_t g_gpu_info_offset; @@ -120,6 +121,10 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& dll_path, g_custom_entries->push_back( google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); + g_num_of_extensions_offset = g_custom_entries->size(); + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry(L"num-extensions", L"N/A")); + g_extension_ids_offset = g_custom_entries->size(); for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { g_custom_entries->push_back(google_breakpad::CustomInfoEntry( @@ -310,6 +315,20 @@ extern "C" void __declspec(dllexport) __cdecl SetClientId( client_id); } +static void SetIntegerValue(size_t offset, int value) { + if (!g_custom_entries) + return; + + wcscpy_s((*g_custom_entries)[offset].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + StringPrintf(L"%d", value).c_str()); +} + +extern "C" void __declspec(dllexport) __cdecl SetNumberOfExtensions( + int number_of_extensions) { + SetIntegerValue(g_num_of_extensions_offset, number_of_extensions); +} + extern "C" void __declspec(dllexport) __cdecl SetExtensionID( int index, const wchar_t* id) { DCHECK(id); @@ -349,12 +368,7 @@ extern "C" void __declspec(dllexport) __cdecl SetGpuInfo( extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews( int number_of_views) { - if (!g_custom_entries) - return; - - wcscpy_s((*g_custom_entries)[g_num_of_views_offset].value, - google_breakpad::CustomInfoEntry::kValueMaxLength, - StringPrintf(L"%d", number_of_views).c_str()); + SetIntegerValue(g_num_of_views_offset, number_of_views); } } // namespace diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 419caa8..1be4921 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -22,6 +22,10 @@ typedef void (__cdecl *MainSetActiveURL)(const wchar_t*); typedef void (__cdecl *MainSetClientId)(const wchar_t*); // exported in breakpad_win.cc: +// void __declspec(dllexport) __cdecl SetNumberOfExtensions. +typedef void (__cdecl *MainSetNumberOfExtensions)(int); + +// exported in breakpad_win.cc: // void __declspec(dllexport) __cdecl SetExtensionID. typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*); @@ -86,6 +90,17 @@ std::string GetClientId() { } void SetActiveExtensions(const std::set& extension_ids) { + static MainSetNumberOfExtensions set_number_of_extensions = NULL; + if (!set_number_of_extensions) { + HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); + if (!exe_module) + return; + set_number_of_extensions = reinterpret_cast( + GetProcAddress(exe_module, "SetNumberOfExtensions")); + if (!set_number_of_extensions) + return; + } + static MainSetExtensionID set_extension_id = NULL; if (!set_extension_id) { HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); @@ -97,6 +112,8 @@ void SetActiveExtensions(const std::set& extension_ids) { return; } + (set_number_of_extensions)(static_cast(extension_ids.size())); + std::set::const_iterator iter = extension_ids.begin(); for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) { if (iter != extension_ids.end()) { -- cgit v1.1