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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/browser/browser_process_sub_thread.h" | 10 #include "content/browser/browser_process_sub_thread.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 | 37 |
38 namespace speech { | 38 namespace speech { |
39 class SpeechRecognitionManagerImpl; | 39 class SpeechRecognitionManagerImpl; |
40 } | 40 } |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 | 43 |
44 class BrowserMainParts; | 44 class BrowserMainParts; |
45 class BrowserShutdownImpl; | 45 class BrowserShutdownImpl; |
46 class BrowserThreadImpl; | 46 class BrowserThreadImpl; |
47 class DevicesMonitor; | |
tommi (sloooow) - chröme
2012/07/30 11:07:04
"devices monitor" doesn't sound right. Even thoug
| |
47 struct MainFunctionParams; | 48 struct MainFunctionParams; |
48 class ResourceDispatcherHostImpl; | 49 class ResourceDispatcherHostImpl; |
49 class WebKitThread; | 50 class WebKitThread; |
50 | 51 |
51 // Implements the main browser loop stages called from BrowserMainRunner. | 52 // Implements the main browser loop stages called from BrowserMainRunner. |
52 // See comments in browser_main_parts.h for additional info. | 53 // See comments in browser_main_parts.h for additional info. |
53 // All functions are to be called only on the UI thread unless otherwise noted. | 54 // All functions are to be called only on the UI thread unless otherwise noted. |
54 class BrowserMainLoop { | 55 class BrowserMainLoop { |
55 public: | 56 public: |
56 explicit BrowserMainLoop(const content::MainFunctionParams& parameters); | 57 explicit BrowserMainLoop(const content::MainFunctionParams& parameters); |
(...skipping 13 matching lines...) Expand all Loading... | |
70 | 71 |
71 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 72 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
72 // through stopping threads to PostDestroyThreads. | 73 // through stopping threads to PostDestroyThreads. |
73 void ShutdownThreadsAndCleanUp(); | 74 void ShutdownThreadsAndCleanUp(); |
74 | 75 |
75 int GetResultCode() const { return result_code_; } | 76 int GetResultCode() const { return result_code_; } |
76 | 77 |
77 // Can be called on any thread. | 78 // Can be called on any thread. |
78 static media::AudioManager* GetAudioManager(); | 79 static media::AudioManager* GetAudioManager(); |
79 static media_stream::MediaStreamManager* GetMediaStreamManager(); | 80 static media_stream::MediaStreamManager* GetMediaStreamManager(); |
81 static content::DevicesMonitor* GetDevicesMonitor(); | |
tommi (sloooow) - chröme
2012/07/30 11:07:04
Why do we need this getter?
| |
80 | 82 |
81 private: | 83 private: |
82 // For ShutdownThreadsAndCleanUp. | 84 // For ShutdownThreadsAndCleanUp. |
83 friend class BrowserShutdownImpl; | 85 friend class BrowserShutdownImpl; |
84 | 86 |
85 void InitializeMainThread(); | 87 void InitializeMainThread(); |
86 | 88 |
87 // Called right after the browser threads have been started. | 89 // Called right after the browser threads have been started. |
88 void BrowserThreadsStarted(); | 90 void BrowserThreadsStarted(); |
89 | 91 |
90 void MainMessageLoopRun(); | 92 void MainMessageLoopRun(); |
91 | 93 |
92 // Members initialized on construction --------------------------------------- | 94 // Members initialized on construction --------------------------------------- |
93 const content::MainFunctionParams& parameters_; | 95 const content::MainFunctionParams& parameters_; |
94 const CommandLine& parsed_command_line_; | 96 const CommandLine& parsed_command_line_; |
95 int result_code_; | 97 int result_code_; |
96 | 98 |
97 // Members initialized in |MainMessageLoopStart()| --------------------------- | 99 // Members initialized in |MainMessageLoopStart()| --------------------------- |
98 scoped_ptr<MessageLoop> main_message_loop_; | 100 scoped_ptr<MessageLoop> main_message_loop_; |
99 scoped_ptr<base::SystemMonitor> system_monitor_; | 101 scoped_ptr<base::SystemMonitor> system_monitor_; |
100 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; | 102 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; |
101 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 103 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
102 scoped_ptr<media::AudioManager> audio_manager_; | 104 scoped_ptr<media::AudioManager> audio_manager_; |
103 scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; | 105 scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; |
104 // Per-process listener for online state changes. | 106 // Per-process listener for online state changes. |
105 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; | 107 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; |
106 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
107 scoped_ptr<SystemMessageWindowWin> system_message_window_; | 109 scoped_ptr<SystemMessageWindowWin> system_message_window_; |
108 #endif | 110 #endif |
111 scoped_ptr<DevicesMonitor> devices_monitor_; | |
tommi (sloooow) - chröme
2012/07/30 11:07:04
should this be in an #else? This is for posix wha
| |
109 | 112 |
110 // Destroy parts_ before main_message_loop_ (required) and before other | 113 // Destroy parts_ before main_message_loop_ (required) and before other |
111 // classes constructed in content (but after main_thread_). | 114 // classes constructed in content (but after main_thread_). |
112 scoped_ptr<BrowserMainParts> parts_; | 115 scoped_ptr<BrowserMainParts> parts_; |
113 | 116 |
114 // Members initialized in |InitializeMainThread()| --------------------------- | 117 // Members initialized in |InitializeMainThread()| --------------------------- |
115 // This must get destroyed before other threads that are created in parts_. | 118 // This must get destroyed before other threads that are created in parts_. |
116 scoped_ptr<BrowserThreadImpl> main_thread_; | 119 scoped_ptr<BrowserThreadImpl> main_thread_; |
117 | 120 |
118 // Members initialized in |BrowserThreadsStarted()| -------------------------- | 121 // Members initialized in |BrowserThreadsStarted()| -------------------------- |
(...skipping 12 matching lines...) Expand all Loading... | |
131 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
132 ui::ScopedOleInitializer ole_initializer_; | 135 ui::ScopedOleInitializer ole_initializer_; |
133 #endif | 136 #endif |
134 | 137 |
135 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 138 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
136 }; | 139 }; |
137 | 140 |
138 } // namespace content | 141 } // namespace content |
139 | 142 |
140 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 143 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |