diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-23 00:27:21 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-23 00:27:21 +0000 |
commit | 20412e064dc875a76ab46575ba7bdcd10d1606aa (patch) | |
tree | 1569d1d55a1f70c055970a68124f9357ce69146c | |
parent | 3b9ed4c40f77238f47ed1f3cbe90afdf035220a4 (diff) | |
download | chromium_src-20412e064dc875a76ab46575ba7bdcd10d1606aa.zip chromium_src-20412e064dc875a76ab46575ba7bdcd10d1606aa.tar.gz chromium_src-20412e064dc875a76ab46575ba7bdcd10d1606aa.tar.bz2 |
Windows Breakpad: Stop doing Breakpad initialisation on a thread
The Breakpad setup was being done on a thread because reading metadata
chrome.dll was slow, but the code has been changed to read the
metadata from chrome.exe which should be faster.
I need to remove the use of threading so that I can change the
Breakpad enablement checks to happen only in the browser process and
be inherited reliably by subprocesses.
Also, this will potentially make any crashes on startup more reliably
reported by Breakpad.
BUG=111265
TEST=none
Review URL: http://codereview.chromium.org/9423016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123149 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/breakpad_win.cc | 35 | ||||
-rw-r--r-- | chrome/app/breakpad_win.h | 2 |
2 files changed, 7 insertions, 30 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index c08cc17..68e23e5c 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -326,7 +326,7 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, return &custom_client_info; } -// Contains the information needed by the worker thread. +// Contains the information needed by InitCrashReporterMain(). struct CrashReporterInfo { google_breakpad::CustomClientInfo* custom_info; std::wstring exe_path; @@ -605,9 +605,9 @@ static bool MetricsReportingControlledByPolicy(bool* result) { return false; } -static DWORD __stdcall InitCrashReporterThread(void* param) { - scoped_ptr<CrashReporterInfo> info( - reinterpret_cast<CrashReporterInfo*>(param)); +// TODO(mseaborn): This function could be merged with InitCrashReporter(). +static void InitCrashReporterMain(CrashReporterInfo* param) { + scoped_ptr<CrashReporterInfo> info(param); bool is_per_user_install = InstallUtil::IsPerUserInstall(info->exe_path.c_str()); @@ -616,8 +616,6 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { GoogleUpdateSettings::GetChromeChannelAndModifiers(!is_per_user_install, &channel_string); - // GetCustomInfo can take a few milliseconds to get the file information, so - // we do it here so it can run in a separate thread. info->custom_info = GetCustomInfo(info->exe_path, info->process_type, channel_string); @@ -669,7 +667,7 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { // for the browser/service processes. if (default_filter) InitDefaultCrashCallback(default_filter); - return 0; + return; } // Build the pipe name. It can be either: @@ -680,7 +678,7 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { if (!base::win::GetUserSidString(&user_sid)) { if (default_filter) InitDefaultCrashCallback(default_filter); - return -1; + return; } } else { user_sid = kSystemPrincipalSid; @@ -738,8 +736,6 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { // generate a crashdump for these exceptions. g_breakpad->set_handle_debug_exceptions(true); } - - return 0; } void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { @@ -752,8 +748,6 @@ void InitCrashReporter() { // Disable the message box for assertions. _CrtSetReportMode(_CRT_ASSERT, 0); - // Query the custom_info now because if we do it in the thread it's going to - // fail in the sandbox. The thread will delete this object. CrashReporterInfo* info(new CrashReporterInfo); info->process_type = command.GetSwitchValueNative(switches::kProcessType); if (info->process_type.empty()) @@ -764,21 +758,6 @@ void InitCrashReporter() { GetModuleFileNameW(NULL, exe_path, MAX_PATH); info->exe_path = exe_path; - // If this is not the browser, we can't be sure that we will be able to - // initialize the crash_handler in another thread, so we run it right away. - // This is important to keep the thread for the browser process because - // it may take some times to initialize the crash_service process. We use - // the Windows worker pool to make better reuse of the thread. - if (info->process_type != L"browser") { - InitCrashReporterThread(info); - } else { - if (QueueUserWorkItem( - &InitCrashReporterThread, - info, - WT_EXECUTELONGFUNCTION) == 0) { - // We failed to queue to the worker pool, initialize in this thread. - InitCrashReporterThread(info); - } - } + InitCrashReporterMain(info); } } diff --git a/chrome/app/breakpad_win.h b/chrome/app/breakpad_win.h index 0633c3a..5299119 100644 --- a/chrome/app/breakpad_win.h +++ b/chrome/app/breakpad_win.h @@ -12,8 +12,6 @@ // The maximum number of 64-char URL chunks we will report. static const int kMaxUrlChunks = 8; -// Calls InitCrashReporterThread in its own thread for the browser process -// or directly for the plugin and renderer process. void InitCrashReporter(); // Intercepts a crash but does not process it, just ask if we want to restart |