diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:12:23 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:12:23 +0000 |
commit | ba80aa757802e51920657a5416e50139f146c6b0 (patch) | |
tree | d5ec93d13c6ecf67eef112d1fd8e46df593d53cc | |
parent | dec7b17e7308a19743191c04f900927e6df32fda (diff) | |
download | chromium_src-ba80aa757802e51920657a5416e50139f146c6b0.zip chromium_src-ba80aa757802e51920657a5416e50139f146c6b0.tar.gz chromium_src-ba80aa757802e51920657a5416e50139f146c6b0.tar.bz2 |
Make Linux Breakpad initialization call to lsb_release asynchronous. Also wrap more
things in USE_LINUX_BREAKPAD while we're at it.
BUG=21782
TEST=Add time.sleep(10) to /usr/bin/lsb_release; starting Chrome should not take 10 seconds more.
Review URL: http://codereview.chromium.org/209042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27001 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/breakpad_linux.cc | 2 | ||||
-rw-r--r-- | chrome/app/breakpad_linux.h | 2 | ||||
-rw-r--r-- | chrome/app/breakpad_linux_stub.cc | 9 | ||||
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 40 | ||||
-rw-r--r-- | chrome/browser/gtk/first_run_dialog.cc | 7 | ||||
-rw-r--r-- | chrome/chrome.gyp | 4 | ||||
-rw-r--r-- | chrome/renderer/renderer_main.cc | 4 |
8 files changed, 39 insertions, 31 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc index a9c11d7..6945a12 100644 --- a/chrome/app/breakpad_linux.cc +++ b/chrome/app/breakpad_linux.cc @@ -24,7 +24,6 @@ #include "base/format_macros.h" #include "base/global_descriptors_posix.h" #include "base/json_writer.h" -#include "base/linux_util.h" #include "base/path_service.h" #include "base/rand_util.h" #include "base/scoped_fd.h" @@ -644,7 +643,6 @@ void InitCrashReporter() { if (process_type.empty()) { if (!(unattended || GoogleUpdateSettings::GetCollectStatsConsent())) return; - base::GetLinuxDistro(); // Initialize base::linux_distro if needed. EnableCrashDumping(unattended); } else if (process_type == switches::kRendererProcess || process_type == switches::kZygoteProcess) { diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h index 53f43a1..e7dfebb 100644 --- a/chrome/app/breakpad_linux.h +++ b/chrome/app/breakpad_linux.h @@ -9,7 +9,6 @@ extern void InitCrashReporter(); -#if defined(USE_LINUX_BREAKPAD) static const size_t kMaxActiveURLSize = 1024; static const size_t kGuidSize = 32; // 128 bits = 32 chars in hex. static const size_t kDistroSize = 128; @@ -28,7 +27,6 @@ struct BreakpadInfo { }; extern int HandleCrashDump(const BreakpadInfo& info); -#endif // defined(USE_LINUX_BREAKPAD) #if defined(GOOGLE_CHROME_BUILD) // Checks that the kernel's core filename pattern is "core" and moves the diff --git a/chrome/app/breakpad_linux_stub.cc b/chrome/app/breakpad_linux_stub.cc deleted file mode 100644 index 05c0166..0000000 --- a/chrome/app/breakpad_linux_stub.cc +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is a stub file which is compiled in when we are building without -// breakpad support. - -void InitCrashReporter() { -} diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 805565d..9f135b5 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -56,6 +56,8 @@ #endif #if defined(OS_LINUX) #include "base/nss_init.h" +#endif +#if defined(USE_LINUX_BREAKPAD) #include "chrome/app/breakpad_linux.h" #endif #include "chrome/app/scoped_ole_initializer.h" diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index cf21a8a..99380a4 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -13,6 +13,7 @@ #include "base/file_util.h" #include "base/histogram.h" #include "base/lazy_instance.h" +#include "base/linux_util.h" #include "base/scoped_nsautorelease_pool.h" #include "base/path_service.h" #include "base/process_util.h" @@ -67,16 +68,19 @@ #if defined(OS_POSIX) // TODO(port): get rid of this include. It's used just to provide declarations // and stub definitions for classes we encouter during the porting effort. -#include "chrome/common/temp_scaffolding_stubs.h" #include <errno.h> #include <signal.h> #include <sys/resource.h> #endif -#if defined(OS_LINUX) +#if defined(USE_LINUX_BREAKPAD) #include "chrome/app/breakpad_linux.h" #endif +#if defined(OS_LINUX) +#include "chrome/common/gtk_util.h" +#endif + // TODO(port): several win-only methods have been pulled out of this, but // BrowserMain() as a whole needs to be broken apart so that it's usable by // other platforms. For now, it's just a stub. This is a serious work in @@ -112,10 +116,6 @@ #include "sandbox/src/sandbox.h" #endif // defined(OS_WIN) -#if defined(OS_LINUX) -#include "chrome/common/gtk_util.h" -#endif - #if defined(TOOLKIT_VIEWS) #include "chrome/browser/views/chrome_views_delegate.h" #include "views/focus/accelerator_handler.h" @@ -195,6 +195,18 @@ void AddFirstRunNewTabs(BrowserInit* browser_init, } #endif +#if defined(USE_LINUX_BREAKPAD) +class GetLinuxDistroTask : public Task { + public: + explicit GetLinuxDistroTask() {} + + virtual void Run() { + base::GetLinuxDistro(); // Initialize base::linux_distro if needed. + } + + DISALLOW_COPY_AND_ASSIGN(GetLinuxDistroTask); +}; +#endif // USE_LINUX_BREAKPAD } // namespace // Main routine for running as the Browser process. @@ -202,12 +214,6 @@ int BrowserMain(const MainFunctionParams& parameters) { const CommandLine& parsed_command_line = parameters.command_line_; base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; -#if defined(OS_LINUX) - // Needs to be called after we have chrome::DIR_USER_DATA. - if (!parsed_command_line.HasSwitch(switches::kGoogleInternalCrashReporting)) - InitCrashReporter(); -#endif - // WARNING: If we get a WM_ENDSESSION objects created on the stack here // are NOT deleted. If you need something to run during WM_ENDSESSION add it // to browser_shutdown::Shutdown or BrowserProcess::EndSession. @@ -299,6 +305,16 @@ int BrowserMain(const MainFunctionParams& parameters) { // BrowserProcessImpl's constructor should set g_browser_process. DCHECK(g_browser_process); +#if defined(USE_LINUX_BREAKPAD) + // Needs to be called after we have chrome::DIR_USER_DATA and + // g_browser_process. + if (!parsed_command_line.HasSwitch(switches::kGoogleInternalCrashReporting)) { + g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, + new GetLinuxDistroTask()); + InitCrashReporter(); + } +#endif + #if defined(OS_WIN) // IMPORTANT: This piece of code needs to run as early as possible in the // process because it will initialize the sandbox broker, which requires the diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc index bac0ca2..b8797c9 100644 --- a/chrome/browser/gtk/first_run_dialog.cc +++ b/chrome/browser/gtk/first_run_dialog.cc @@ -7,7 +7,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/message_loop.h" -#include "chrome/app/breakpad_linux.h" #include "chrome/browser/gtk/gtk_chrome_link_button.h" #include "chrome/browser/shell_integration.h" #include "chrome/common/gtk_util.h" @@ -17,6 +16,10 @@ #include "grit/google_chrome_strings.h" #include "grit/locale_settings.h" +#if defined(USE_LINUX_BREAKPAD) +#include "chrome/app/breakpad_linux.h" +#endif + // static bool FirstRunDialog::Show(Profile* profile) { int response = -1; @@ -134,9 +137,11 @@ void FirstRunDialog::OnDialogResponse(GtkWidget* widget, int response) { // Check if user has opted into reporting. if (report_crashes_ && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(report_crashes_))) { +#if defined(USE_LINUX_BREAKPAD) if (GoogleUpdateSettings::SetCollectStatsConsent(true)) { InitCrashReporter(); } +#endif } else { GoogleUpdateSettings::SetCollectStatsConsent(false); } diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 3f6236a..1f28ab2 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2275,11 +2275,9 @@ # breakpad_linux.cc wants file_version_info_linux.h '<(SHARED_INTERMEDIATE_DIR)', ], - }, { + }, { # linux_breakpad==0 'sources': [ 'browser/renderer_host/render_crash_handler_host_linux_stub.cc', - 'app/breakpad_linux_stub.cc', - 'app/breakpad_linux.h', ], }], ['linux_sandbox_path != ""', { diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index 6c7f01b..14a9d81 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -28,7 +28,7 @@ #include "grit/generated_resources.h" #include "net/base/net_module.h" -#if defined(OS_LINUX) +#if defined(USE_LINUX_BREAKPAD) #include "chrome/app/breakpad_linux.h" #endif @@ -83,7 +83,7 @@ int RendererMain(const MainFunctionParams& parameters) { const CommandLine& parsed_command_line = parameters.command_line_; base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; -#if defined(OS_LINUX) +#if defined(USE_LINUX_BREAKPAD) // Needs to be called after we have chrome::DIR_USER_DATA. InitCrashReporter(); #endif |