Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/browser/browser_main_runner.h" | 5 #include "content/public/browser/browser_main_runner.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_shim.h" | 7 #include "base/allocator/allocator_shim.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 ~BrowserMainRunnerImpl() { | 35 ~BrowserMainRunnerImpl() { |
| 36 if (is_initialized_ && !is_shutdown_) | 36 if (is_initialized_ && !is_shutdown_) |
| 37 Shutdown(); | 37 Shutdown(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual int Initialize(const content::MainFunctionParams& parameters) | 40 virtual int Initialize(const content::MainFunctionParams& parameters) |
| 41 OVERRIDE { | 41 OVERRIDE { |
| 42 is_initialized_ = true; | 42 is_initialized_ = true; |
| 43 | 43 |
| 44 statistics_.reset(new base::StatisticsRecorder); | |
|
Marshall
2012/03/02 02:14:06
This should probably come after the WaitForDebugge
kaiwang
2012/03/02 04:26:56
Done.
| |
| 45 | |
| 44 // ChildProcess:: is a misnomer unless you consider context. Use | 46 // ChildProcess:: is a misnomer unless you consider context. Use |
| 45 // of --wait-for-debugger only makes sense when Chrome itself is a | 47 // of --wait-for-debugger only makes sense when Chrome itself is a |
| 46 // child process (e.g. when launched by PyAuto). | 48 // child process (e.g. when launched by PyAuto). |
| 47 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | 49 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) |
| 48 ChildProcess::WaitForDebugger("Browser"); | 50 ChildProcess::WaitForDebugger("Browser"); |
| 49 | 51 |
| 50 notification_service_.reset(new NotificationServiceImpl); | 52 notification_service_.reset(new NotificationServiceImpl); |
| 51 | 53 |
| 52 main_loop_.reset(new content::BrowserMainLoop(parameters)); | 54 main_loop_.reset(new content::BrowserMainLoop(parameters)); |
| 53 | 55 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 69 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic | 71 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic |
| 70 // allocator selection is not supported. | 72 // allocator selection is not supported. |
| 71 | 73 |
| 72 // Make this call before going multithreaded, or spawning any subprocesses. | 74 // Make this call before going multithreaded, or spawning any subprocesses. |
| 73 base::allocator::SetupSubprocessAllocator(); | 75 base::allocator::SetupSubprocessAllocator(); |
| 74 #endif | 76 #endif |
| 75 | 77 |
| 76 com_initializer_.reset(new base::win::ScopedCOMInitializer); | 78 com_initializer_.reset(new base::win::ScopedCOMInitializer); |
| 77 #endif // OS_WIN | 79 #endif // OS_WIN |
| 78 | 80 |
| 79 statistics_.reset(new base::StatisticsRecorder); | |
| 80 | |
| 81 main_loop_->CreateThreads(); | 81 main_loop_->CreateThreads(); |
| 82 int result_code = main_loop_->GetResultCode(); | 82 int result_code = main_loop_->GetResultCode(); |
| 83 if (result_code > 0) | 83 if (result_code > 0) |
| 84 return result_code; | 84 return result_code; |
| 85 created_threads_ = true; | 85 created_threads_ = true; |
| 86 | 86 |
| 87 // Return -1 to indicate no early termination. | 87 // Return -1 to indicate no early termination. |
| 88 return -1; | 88 return -1; |
| 89 } | 89 } |
| 90 | 90 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 } // namespace | 139 } // namespace |
| 140 | 140 |
| 141 namespace content { | 141 namespace content { |
| 142 | 142 |
| 143 // static | 143 // static |
| 144 BrowserMainRunner* BrowserMainRunner::Create() { | 144 BrowserMainRunner* BrowserMainRunner::Create() { |
| 145 return new BrowserMainRunnerImpl(); | 145 return new BrowserMainRunnerImpl(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace content | 148 } // namespace content |
| OLD | NEW |