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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/browser/browser_process_sub_thread.h" | 11 #include "content/browser/browser_process_sub_thread.h" |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include "ui/base/win/scoped_ole_initializer.h" | 14 #include "ui/base/win/scoped_ole_initializer.h" |
15 #endif | 15 #endif |
16 | 16 |
17 class AudioManager; | |
18 class BrowserOnlineStateObserver; | 17 class BrowserOnlineStateObserver; |
19 class CommandLine; | 18 class CommandLine; |
20 class HighResolutionTimerManager; | 19 class HighResolutionTimerManager; |
21 class MessageLoop; | 20 class MessageLoop; |
22 class SystemMessageWindowWin; | 21 class SystemMessageWindowWin; |
23 | 22 |
24 namespace base { | 23 namespace base { |
25 class SystemMonitor; | 24 class SystemMonitor; |
26 } | 25 } |
27 | 26 |
| 27 namespace media { |
| 28 class AudioManager; |
| 29 } |
| 30 |
28 namespace net { | 31 namespace net { |
29 class NetworkChangeNotifier; | 32 class NetworkChangeNotifier; |
30 } | 33 } |
31 | 34 |
32 namespace content { | 35 namespace content { |
33 | 36 |
34 class BrowserMainParts; | 37 class BrowserMainParts; |
35 class BrowserShutdownImpl; | 38 class BrowserShutdownImpl; |
36 class BrowserThreadImpl; | 39 class BrowserThreadImpl; |
37 struct MainFunctionParams; | 40 struct MainFunctionParams; |
(...skipping 21 matching lines...) Expand all Loading... |
59 // Perform the default message loop run logic. | 62 // Perform the default message loop run logic. |
60 void RunMainMessageLoopParts(); | 63 void RunMainMessageLoopParts(); |
61 | 64 |
62 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 65 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
63 // through stopping threads to PostDestroyThreads. | 66 // through stopping threads to PostDestroyThreads. |
64 void ShutdownThreadsAndCleanUp(); | 67 void ShutdownThreadsAndCleanUp(); |
65 | 68 |
66 int GetResultCode() const { return result_code_; } | 69 int GetResultCode() const { return result_code_; } |
67 | 70 |
68 // Can be called on any thread. | 71 // Can be called on any thread. |
69 static AudioManager* GetAudioManager(); | 72 static media::AudioManager* GetAudioManager(); |
70 | 73 |
71 private: | 74 private: |
72 // For ShutdownThreadsAndCleanUp. | 75 // For ShutdownThreadsAndCleanUp. |
73 friend class BrowserShutdownImpl; | 76 friend class BrowserShutdownImpl; |
74 | 77 |
75 void InitializeMainThread(); | 78 void InitializeMainThread(); |
76 | 79 |
77 // Called right after the browser threads have been started. | 80 // Called right after the browser threads have been started. |
78 void BrowserThreadsStarted(); | 81 void BrowserThreadsStarted(); |
79 | 82 |
80 void MainMessageLoopRun(); | 83 void MainMessageLoopRun(); |
81 | 84 |
82 // Members initialized on construction --------------------------------------- | 85 // Members initialized on construction --------------------------------------- |
83 const content::MainFunctionParams& parameters_; | 86 const content::MainFunctionParams& parameters_; |
84 const CommandLine& parsed_command_line_; | 87 const CommandLine& parsed_command_line_; |
85 int result_code_; | 88 int result_code_; |
86 | 89 |
87 // Members initialized in |MainMessageLoopStart()| --------------------------- | 90 // Members initialized in |MainMessageLoopStart()| --------------------------- |
88 scoped_ptr<MessageLoop> main_message_loop_; | 91 scoped_ptr<MessageLoop> main_message_loop_; |
89 scoped_ptr<base::SystemMonitor> system_monitor_; | 92 scoped_ptr<base::SystemMonitor> system_monitor_; |
90 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; | 93 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; |
91 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 94 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
92 scoped_ptr<AudioManager> audio_manager_; | 95 scoped_ptr<media::AudioManager> audio_manager_; |
93 // Per-process listener for online state changes. | 96 // Per-process listener for online state changes. |
94 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; | 97 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; |
95 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
96 scoped_ptr<SystemMessageWindowWin> system_message_window_; | 99 scoped_ptr<SystemMessageWindowWin> system_message_window_; |
97 #elif defined(OS_LINUX) | 100 #elif defined(OS_LINUX) |
98 scoped_refptr<MediaDeviceNotificationsLinux> | 101 scoped_refptr<MediaDeviceNotificationsLinux> |
99 media_device_notifications_linux_; | 102 media_device_notifications_linux_; |
100 #endif | 103 #endif |
101 | 104 |
102 // Destroy parts_ before main_message_loop_ (required) and before other | 105 // Destroy parts_ before main_message_loop_ (required) and before other |
(...skipping 19 matching lines...) Expand all Loading... |
122 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
123 ui::ScopedOleInitializer ole_initializer_; | 126 ui::ScopedOleInitializer ole_initializer_; |
124 #endif | 127 #endif |
125 | 128 |
126 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 129 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
127 }; | 130 }; |
128 | 131 |
129 } // namespace content | 132 } // namespace content |
130 | 133 |
131 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 134 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |