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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // ChildProcess:: is a misnomer unless you consider context. Use | 46 // ChildProcess:: is a misnomer unless you consider context. Use |
47 // 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 |
48 // child process (e.g. when launched by PyAuto). | 48 // child process (e.g. when launched by PyAuto). |
49 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | 49 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) |
50 ChildProcess::WaitForDebugger("Browser"); | 50 ChildProcess::WaitForDebugger("Browser"); |
51 | 51 |
52 if (parameters.command_line.HasSwitch(switches::kSingleProcess)) | 52 if (parameters.command_line.HasSwitch(switches::kSingleProcess)) |
53 content::RenderProcessHost::set_run_renderer_in_process(true); | 53 content::RenderProcessHost::set_run_renderer_in_process(true); |
54 | 54 |
55 statistics_.reset(new base::StatisticsRecorder); | 55 base::StatisticsRecorder::Initialize(); |
56 | 56 |
57 notification_service_.reset(new NotificationServiceImpl); | 57 notification_service_.reset(new NotificationServiceImpl); |
58 | 58 |
59 main_loop_.reset(new content::BrowserMainLoop(parameters)); | 59 main_loop_.reset(new content::BrowserMainLoop(parameters)); |
60 | 60 |
61 main_loop_->Init(); | 61 main_loop_->Init(); |
62 | 62 |
63 main_loop_->EarlyInitialization(); | 63 main_loop_->EarlyInitialization(); |
64 | 64 |
65 // Must happen before we try to use a message loop or display any UI. | 65 // Must happen before we try to use a message loop or display any UI. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 main_loop_->ShutdownThreadsAndCleanUp(); | 109 main_loop_->ShutdownThreadsAndCleanUp(); |
110 | 110 |
111 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
112 com_initializer_.reset(NULL); | 112 com_initializer_.reset(NULL); |
113 #endif | 113 #endif |
114 | 114 |
115 main_loop_.reset(NULL); | 115 main_loop_.reset(NULL); |
116 | 116 |
117 notification_service_.reset(NULL); | 117 notification_service_.reset(NULL); |
118 | 118 |
119 statistics_.reset(NULL); | |
120 | |
121 is_shutdown_ = true; | 119 is_shutdown_ = true; |
122 } | 120 } |
123 | 121 |
124 protected: | 122 protected: |
125 // True if the runner has been initialized. | 123 // True if the runner has been initialized. |
126 bool is_initialized_; | 124 bool is_initialized_; |
127 | 125 |
128 // True if the runner has been shut down. | 126 // True if the runner has been shut down. |
129 bool is_shutdown_; | 127 bool is_shutdown_; |
130 | 128 |
131 // True if the non-UI threads were created. | 129 // True if the non-UI threads were created. |
132 bool created_threads_; | 130 bool created_threads_; |
133 | 131 |
134 scoped_ptr<NotificationServiceImpl> notification_service_; | 132 scoped_ptr<NotificationServiceImpl> notification_service_; |
135 scoped_ptr<content::BrowserMainLoop> main_loop_; | 133 scoped_ptr<content::BrowserMainLoop> main_loop_; |
136 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
137 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 135 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
138 #endif | 136 #endif |
139 scoped_ptr<base::StatisticsRecorder> statistics_; | |
140 | 137 |
141 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 138 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
142 }; | 139 }; |
143 | 140 |
144 } // namespace | 141 } // namespace |
145 | 142 |
146 namespace content { | 143 namespace content { |
147 | 144 |
148 // static | 145 // static |
149 BrowserMainRunner* BrowserMainRunner::Create() { | 146 BrowserMainRunner* BrowserMainRunner::Create() { |
150 return new BrowserMainRunnerImpl(); | 147 return new BrowserMainRunnerImpl(); |
151 } | 148 } |
152 | 149 |
153 } // namespace content | 150 } // namespace content |
OLD | NEW |