diff options
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 40 |
1 files changed, 28 insertions, 12 deletions
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 |