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 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 media::AudioManager* audio_manager() const { return audio_manager_.get(); } | 109 media::AudioManager* audio_manager() const { return audio_manager_.get(); } |
110 MediaStreamManager* media_stream_manager() const { | 110 MediaStreamManager* media_stream_manager() const { |
111 return media_stream_manager_.get(); | 111 return media_stream_manager_.get(); |
112 } | 112 } |
113 media::UserInputMonitor* user_input_monitor() const { | 113 media::UserInputMonitor* user_input_monitor() const { |
114 return user_input_monitor_.get(); | 114 return user_input_monitor_.get(); |
115 } | 115 } |
116 media::midi::MidiManager* midi_manager() const { return midi_manager_.get(); } | 116 media::midi::MidiManager* midi_manager() const { return midi_manager_.get(); } |
117 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } | 117 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } |
118 | 118 |
119 bool is_tracing_startup_for_duration() const { | 119 bool is_tracing_startup() const { return is_tracing_startup_; } |
120 return is_tracing_startup_for_duration_; | |
121 } | |
122 | 120 |
123 const base::FilePath& startup_trace_file() const { | 121 const base::FilePath& startup_trace_file() const { |
124 return startup_trace_file_; | 122 return startup_trace_file_; |
125 } | 123 } |
126 | 124 |
127 void StopStartupTracingTimer(); | 125 void StopStartupTracingTimer(); |
128 | 126 |
129 #if defined(OS_MACOSX) && !defined(OS_IOS) | 127 #if defined(OS_MACOSX) && !defined(OS_IOS) |
130 DeviceMonitorMac* device_monitor_mac() const { | 128 DeviceMonitorMac* device_monitor_mac() const { |
131 return device_monitor_mac_.get(); | 129 return device_monitor_mac_.get(); |
(...skipping 15 matching lines...) Expand all Loading... |
147 | 145 |
148 // Called right after the browser threads have been started. | 146 // Called right after the browser threads have been started. |
149 int BrowserThreadsStarted(); | 147 int BrowserThreadsStarted(); |
150 | 148 |
151 int PreMainMessageLoopRun(); | 149 int PreMainMessageLoopRun(); |
152 | 150 |
153 void MainMessageLoopRun(); | 151 void MainMessageLoopRun(); |
154 | 152 |
155 base::FilePath GetStartupTraceFileName( | 153 base::FilePath GetStartupTraceFileName( |
156 const base::CommandLine& command_line) const; | 154 const base::CommandLine& command_line) const; |
157 void InitStartupTracingForDuration(const base::CommandLine& command_line); | 155 void InitStartupTracing(const base::CommandLine& command_line); |
158 void EndStartupTracing(); | 156 void EndStartupTracing(); |
159 | 157 |
160 bool UsingInProcessGpu() const; | 158 bool UsingInProcessGpu() const; |
161 | 159 |
162 // Quick reference for initialization order: | 160 // Quick reference for initialization order: |
163 // Constructor | 161 // Constructor |
164 // Init() | 162 // Init() |
165 // EarlyInitialization() | 163 // EarlyInitialization() |
166 // InitializeToolkit() | 164 // InitializeToolkit() |
167 // PreMainMessageLoopStart() | 165 // PreMainMessageLoopStart() |
168 // MainMessageLoopStart() | 166 // MainMessageLoopStart() |
169 // InitializeMainThread() | 167 // InitializeMainThread() |
170 // PostMainMessageLoopStart() | 168 // PostMainMessageLoopStart() |
171 // InitStartupTracingForDuration() | 169 // InitStartupTracing() |
172 // CreateStartupTasks() | 170 // CreateStartupTasks() |
173 // PreCreateThreads() | 171 // PreCreateThreads() |
174 // CreateThreads() | 172 // CreateThreads() |
175 // BrowserThreadsStarted() | 173 // BrowserThreadsStarted() |
176 | 174 |
177 // Members initialized on construction --------------------------------------- | 175 // Members initialized on construction --------------------------------------- |
178 const MainFunctionParams& parameters_; | 176 const MainFunctionParams& parameters_; |
179 const base::CommandLine& parsed_command_line_; | 177 const base::CommandLine& parsed_command_line_; |
180 int result_code_; | 178 int result_code_; |
181 bool created_threads_; // True if the non-UI threads were created. | 179 bool created_threads_; // True if the non-UI threads were created. |
182 bool is_tracing_startup_for_duration_; | 180 bool is_tracing_startup_; |
183 | 181 |
184 // Members initialized in |MainMessageLoopStart()| --------------------------- | 182 // Members initialized in |MainMessageLoopStart()| --------------------------- |
185 scoped_ptr<base::MessageLoop> main_message_loop_; | 183 scoped_ptr<base::MessageLoop> main_message_loop_; |
186 | 184 |
187 // Members initialized in |PostMainMessageLoopStart()| ----------------------- | 185 // Members initialized in |PostMainMessageLoopStart()| ----------------------- |
188 scoped_ptr<base::SystemMonitor> system_monitor_; | 186 scoped_ptr<base::SystemMonitor> system_monitor_; |
189 scoped_ptr<base::PowerMonitor> power_monitor_; | 187 scoped_ptr<base::PowerMonitor> power_monitor_; |
190 scoped_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; | 188 scoped_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; |
191 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 189 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
192 | 190 |
193 // Per-process listener for online state changes. | 191 // Per-process listener for online state changes. |
194 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; | 192 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; |
195 | 193 |
196 scoped_ptr<base::trace_event::TraceEventSystemStatsMonitor> | 194 scoped_ptr<base::trace_event::TraceEventSystemStatsMonitor> |
197 system_stats_monitor_; | 195 system_stats_monitor_; |
198 | 196 |
199 #if defined(OS_WIN) | 197 #if defined(OS_WIN) |
200 scoped_ptr<SystemMessageWindowWin> system_message_window_; | 198 scoped_ptr<SystemMessageWindowWin> system_message_window_; |
201 #endif | 199 #endif |
202 | 200 |
203 #if defined(OS_ANDROID) | 201 #if defined(OS_ANDROID) |
204 // Android implementation of ScreenOrientationDelegate | 202 // Android implementation of ScreenOrientationDelegate |
205 scoped_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; | 203 scoped_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; |
206 #endif | 204 #endif |
207 | 205 |
208 scoped_ptr<MemoryObserver> memory_observer_; | 206 scoped_ptr<MemoryObserver> memory_observer_; |
209 scoped_ptr<base::trace_event::TraceMemoryController> trace_memory_controller_; | 207 scoped_ptr<base::trace_event::TraceMemoryController> trace_memory_controller_; |
210 | 208 |
211 // Members initialized in |InitStartupTracingForDuration()| ------------------ | 209 // Members initialized in |InitStartupTracing()| ----------------------------- |
212 base::FilePath startup_trace_file_; | 210 base::FilePath startup_trace_file_; |
213 | 211 |
214 // This timer initiates trace file saving. | 212 // This timer initiates trace file saving. |
215 base::OneShotTimer<BrowserMainLoop> startup_trace_timer_; | 213 base::OneShotTimer<BrowserMainLoop> startup_trace_timer_; |
216 | 214 |
217 // Members initialized in |Init()| ------------------------------------------- | 215 // Members initialized in |Init()| ------------------------------------------- |
218 // Destroy |parts_| before |main_message_loop_| (required) and before other | 216 // Destroy |parts_| before |main_message_loop_| (required) and before other |
219 // classes constructed in content (but after |main_thread_|). | 217 // classes constructed in content (but after |main_thread_|). |
220 scoped_ptr<BrowserMainParts> parts_; | 218 scoped_ptr<BrowserMainParts> parts_; |
221 | 219 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 scoped_ptr<TimeZoneMonitor> time_zone_monitor_; | 261 scoped_ptr<TimeZoneMonitor> time_zone_monitor_; |
264 | 262 |
265 // DO NOT add members here. Add them to the right categories above. | 263 // DO NOT add members here. Add them to the right categories above. |
266 | 264 |
267 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 265 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
268 }; | 266 }; |
269 | 267 |
270 } // namespace content | 268 } // namespace content |
271 | 269 |
272 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 270 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |