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 <memory> |
| 9 |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "content/browser/browser_process_sub_thread.h" | 15 #include "content/browser/browser_process_sub_thread.h" |
15 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class CommandLine; | 19 class CommandLine; |
19 class FilePath; | 20 class FilePath; |
20 class HighResolutionTimerManager; | 21 class HighResolutionTimerManager; |
21 class MessageLoop; | 22 class MessageLoop; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // BrowserThreadsStarted() | 181 // BrowserThreadsStarted() |
181 | 182 |
182 // Members initialized on construction --------------------------------------- | 183 // Members initialized on construction --------------------------------------- |
183 const MainFunctionParams& parameters_; | 184 const MainFunctionParams& parameters_; |
184 const base::CommandLine& parsed_command_line_; | 185 const base::CommandLine& parsed_command_line_; |
185 int result_code_; | 186 int result_code_; |
186 bool created_threads_; // True if the non-UI threads were created. | 187 bool created_threads_; // True if the non-UI threads were created. |
187 bool is_tracing_startup_for_duration_; | 188 bool is_tracing_startup_for_duration_; |
188 | 189 |
189 // Members initialized in |MainMessageLoopStart()| --------------------------- | 190 // Members initialized in |MainMessageLoopStart()| --------------------------- |
190 scoped_ptr<base::MessageLoop> main_message_loop_; | 191 std::unique_ptr<base::MessageLoop> main_message_loop_; |
191 | 192 |
192 // Members initialized in |PostMainMessageLoopStart()| ----------------------- | 193 // Members initialized in |PostMainMessageLoopStart()| ----------------------- |
193 scoped_ptr<base::SystemMonitor> system_monitor_; | 194 std::unique_ptr<base::SystemMonitor> system_monitor_; |
194 scoped_ptr<base::PowerMonitor> power_monitor_; | 195 std::unique_ptr<base::PowerMonitor> power_monitor_; |
195 scoped_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; | 196 std::unique_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; |
196 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 197 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
197 | 198 |
198 // Per-process listener for online state changes. | 199 // Per-process listener for online state changes. |
199 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; | 200 std::unique_ptr<BrowserOnlineStateObserver> online_state_observer_; |
200 | 201 |
201 scoped_ptr<base::trace_event::TraceEventSystemStatsMonitor> | 202 std::unique_ptr<base::trace_event::TraceEventSystemStatsMonitor> |
202 system_stats_monitor_; | 203 system_stats_monitor_; |
203 | 204 |
204 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
205 scoped_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; | 206 std::unique_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; |
206 #endif | 207 #endif |
207 | 208 |
208 #if defined(OS_ANDROID) | 209 #if defined(OS_ANDROID) |
209 // Android implementation of ScreenOrientationDelegate | 210 // Android implementation of ScreenOrientationDelegate |
210 scoped_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; | 211 std::unique_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; |
211 #endif | 212 #endif |
212 | 213 |
213 scoped_ptr<MemoryObserver> memory_observer_; | 214 std::unique_ptr<MemoryObserver> memory_observer_; |
214 | 215 |
215 // Members initialized in |InitStartupTracingForDuration()| ------------------ | 216 // Members initialized in |InitStartupTracingForDuration()| ------------------ |
216 base::FilePath startup_trace_file_; | 217 base::FilePath startup_trace_file_; |
217 | 218 |
218 // This timer initiates trace file saving. | 219 // This timer initiates trace file saving. |
219 base::OneShotTimer startup_trace_timer_; | 220 base::OneShotTimer startup_trace_timer_; |
220 | 221 |
221 // Members initialized in |Init()| ------------------------------------------- | 222 // Members initialized in |Init()| ------------------------------------------- |
222 // Destroy |parts_| before |main_message_loop_| (required) and before other | 223 // Destroy |parts_| before |main_message_loop_| (required) and before other |
223 // classes constructed in content (but after |main_thread_|). | 224 // classes constructed in content (but after |main_thread_|). |
224 scoped_ptr<BrowserMainParts> parts_; | 225 std::unique_ptr<BrowserMainParts> parts_; |
225 | 226 |
226 // Members initialized in |InitializeMainThread()| --------------------------- | 227 // Members initialized in |InitializeMainThread()| --------------------------- |
227 // This must get destroyed before other threads that are created in |parts_|. | 228 // This must get destroyed before other threads that are created in |parts_|. |
228 scoped_ptr<BrowserThreadImpl> main_thread_; | 229 std::unique_ptr<BrowserThreadImpl> main_thread_; |
229 | 230 |
230 // Members initialized in |CreateStartupTasks()| ----------------------------- | 231 // Members initialized in |CreateStartupTasks()| ----------------------------- |
231 scoped_ptr<StartupTaskRunner> startup_task_runner_; | 232 std::unique_ptr<StartupTaskRunner> startup_task_runner_; |
232 | 233 |
233 // Members initialized in |PreCreateThreads()| ------------------------------- | 234 // Members initialized in |PreCreateThreads()| ------------------------------- |
234 // Torn down in ShutdownThreadsAndCleanUp. | 235 // Torn down in ShutdownThreadsAndCleanUp. |
235 scoped_ptr<base::MemoryPressureMonitor> memory_pressure_monitor_; | 236 std::unique_ptr<base::MemoryPressureMonitor> memory_pressure_monitor_; |
236 | 237 |
237 // Members initialized in |CreateThreads()| ---------------------------------- | 238 // Members initialized in |CreateThreads()| ---------------------------------- |
238 scoped_ptr<BrowserProcessSubThread> db_thread_; | 239 std::unique_ptr<BrowserProcessSubThread> db_thread_; |
239 scoped_ptr<BrowserProcessSubThread> file_user_blocking_thread_; | 240 std::unique_ptr<BrowserProcessSubThread> file_user_blocking_thread_; |
240 scoped_ptr<BrowserProcessSubThread> file_thread_; | 241 std::unique_ptr<BrowserProcessSubThread> file_thread_; |
241 scoped_ptr<BrowserProcessSubThread> process_launcher_thread_; | 242 std::unique_ptr<BrowserProcessSubThread> process_launcher_thread_; |
242 scoped_ptr<BrowserProcessSubThread> cache_thread_; | 243 std::unique_ptr<BrowserProcessSubThread> cache_thread_; |
243 scoped_ptr<BrowserProcessSubThread> io_thread_; | 244 std::unique_ptr<BrowserProcessSubThread> io_thread_; |
244 | 245 |
245 // Members initialized in |BrowserThreadsStarted()| -------------------------- | 246 // Members initialized in |BrowserThreadsStarted()| -------------------------- |
246 scoped_ptr<base::Thread> indexed_db_thread_; | 247 std::unique_ptr<base::Thread> indexed_db_thread_; |
247 scoped_ptr<MojoShellContext> mojo_shell_context_; | 248 std::unique_ptr<MojoShellContext> mojo_shell_context_; |
248 scoped_ptr<IPC::ScopedIPCSupport> mojo_ipc_support_; | 249 std::unique_ptr<IPC::ScopedIPCSupport> mojo_ipc_support_; |
249 | 250 |
250 // |user_input_monitor_| has to outlive |audio_manager_|, so declared first. | 251 // |user_input_monitor_| has to outlive |audio_manager_|, so declared first. |
251 scoped_ptr<media::UserInputMonitor> user_input_monitor_; | 252 std::unique_ptr<media::UserInputMonitor> user_input_monitor_; |
252 scoped_ptr<media::AudioManager> audio_manager_; | 253 std::unique_ptr<media::AudioManager> audio_manager_; |
253 | 254 |
254 scoped_ptr<media::midi::MidiManager> midi_manager_; | 255 std::unique_ptr<media::midi::MidiManager> midi_manager_; |
255 | 256 |
256 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
257 scoped_ptr<media::SystemMessageWindowWin> system_message_window_; | 258 std::unique_ptr<media::SystemMessageWindowWin> system_message_window_; |
258 #elif defined(OS_LINUX) && defined(USE_UDEV) | 259 #elif defined(OS_LINUX) && defined(USE_UDEV) |
259 scoped_ptr<media::DeviceMonitorLinux> device_monitor_linux_; | 260 std::unique_ptr<media::DeviceMonitorLinux> device_monitor_linux_; |
260 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 261 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
261 scoped_ptr<media::DeviceMonitorMac> device_monitor_mac_; | 262 std::unique_ptr<media::DeviceMonitorMac> device_monitor_mac_; |
262 #endif | 263 #endif |
263 #if defined(USE_OZONE) | 264 #if defined(USE_OZONE) |
264 scoped_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; | 265 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
265 #endif | 266 #endif |
266 | 267 |
267 scoped_ptr<ResourceDispatcherHostImpl> resource_dispatcher_host_; | 268 std::unique_ptr<ResourceDispatcherHostImpl> resource_dispatcher_host_; |
268 scoped_ptr<MediaStreamManager> media_stream_manager_; | 269 std::unique_ptr<MediaStreamManager> media_stream_manager_; |
269 scoped_ptr<SpeechRecognitionManagerImpl> speech_recognition_manager_; | 270 std::unique_ptr<SpeechRecognitionManagerImpl> speech_recognition_manager_; |
270 scoped_ptr<TimeZoneMonitor> time_zone_monitor_; | 271 std::unique_ptr<TimeZoneMonitor> time_zone_monitor_; |
271 | 272 |
272 // DO NOT add members here. Add them to the right categories above. | 273 // DO NOT add members here. Add them to the right categories above. |
273 | 274 |
274 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 275 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
275 }; | 276 }; |
276 | 277 |
277 } // namespace content | 278 } // namespace content |
278 | 279 |
279 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 280 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |