| 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/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 class AudioMirroringManager; | 37 class AudioMirroringManager; |
| 38 class BrowserMainParts; | 38 class BrowserMainParts; |
| 39 class BrowserOnlineStateObserver; | 39 class BrowserOnlineStateObserver; |
| 40 class BrowserShutdownImpl; | 40 class BrowserShutdownImpl; |
| 41 class BrowserThreadImpl; | 41 class BrowserThreadImpl; |
| 42 class MediaStreamManager; | 42 class MediaStreamManager; |
| 43 class ResourceDispatcherHostImpl; | 43 class ResourceDispatcherHostImpl; |
| 44 class SpeechRecognitionManagerImpl; | 44 class SpeechRecognitionManagerImpl; |
| 45 class StartupTaskRunner; |
| 45 class SystemMessageWindowWin; | 46 class SystemMessageWindowWin; |
| 46 struct MainFunctionParams; | 47 struct MainFunctionParams; |
| 47 | 48 |
| 48 #if defined(OS_LINUX) | 49 #if defined(OS_LINUX) |
| 49 class DeviceMonitorLinux; | 50 class DeviceMonitorLinux; |
| 50 #elif defined(OS_MACOSX) | 51 #elif defined(OS_MACOSX) |
| 51 class DeviceMonitorMac; | 52 class DeviceMonitorMac; |
| 52 #endif | 53 #endif |
| 53 | 54 |
| 54 // Implements the main browser loop stages called from BrowserMainRunner. | 55 // Implements the main browser loop stages called from BrowserMainRunner. |
| 55 // See comments in browser_main_parts.h for additional info. | 56 // See comments in browser_main_parts.h for additional info. |
| 56 class CONTENT_EXPORT BrowserMainLoop { | 57 class CONTENT_EXPORT BrowserMainLoop { |
| 57 public: | 58 public: |
| 58 // Returns the current instance. This is used to get access to the getters | 59 // Returns the current instance. This is used to get access to the getters |
| 59 // that return objects which are owned by this class. | 60 // that return objects which are owned by this class. |
| 60 static BrowserMainLoop* GetInstance(); | 61 static BrowserMainLoop* GetInstance(); |
| 61 | 62 |
| 62 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 63 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 63 virtual ~BrowserMainLoop(); | 64 virtual ~BrowserMainLoop(); |
| 64 | 65 |
| 65 void Init(); | 66 void Init(); |
| 66 | 67 |
| 67 void EarlyInitialization(); | 68 void EarlyInitialization(); |
| 68 void InitializeToolkit(); | 69 void InitializeToolkit(); |
| 69 void MainMessageLoopStart(); | 70 void MainMessageLoopStart(); |
| 70 | 71 |
| 71 // Create the tasks we need to complete startup. | 72 // Create and start running the tasks we need to complete startup. Note that |
| 73 // this can be called more than once (currently only on Android) if we get a |
| 74 // request for synchronous startup while the tasks created by asynchronous |
| 75 // startup are still running. |
| 72 void CreateStartupTasks(); | 76 void CreateStartupTasks(); |
| 73 | 77 |
| 74 // Perform the default message loop run logic. | 78 // Perform the default message loop run logic. |
| 75 void RunMainMessageLoopParts(); | 79 void RunMainMessageLoopParts(); |
| 76 | 80 |
| 77 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 81 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
| 78 // through stopping threads to PostDestroyThreads. | 82 // through stopping threads to PostDestroyThreads. |
| 79 void ShutdownThreadsAndCleanUp(); | 83 void ShutdownThreadsAndCleanUp(); |
| 80 | 84 |
| 81 int GetResultCode() const { return result_code_; } | 85 int GetResultCode() const { return result_code_; } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 scoped_ptr<MediaStreamManager> media_stream_manager_; | 138 scoped_ptr<MediaStreamManager> media_stream_manager_; |
| 135 // Per-process listener for online state changes. | 139 // Per-process listener for online state changes. |
| 136 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; | 140 scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; |
| 137 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 138 scoped_ptr<SystemMessageWindowWin> system_message_window_; | 142 scoped_ptr<SystemMessageWindowWin> system_message_window_; |
| 139 #elif defined(OS_LINUX) | 143 #elif defined(OS_LINUX) |
| 140 scoped_ptr<DeviceMonitorLinux> device_monitor_linux_; | 144 scoped_ptr<DeviceMonitorLinux> device_monitor_linux_; |
| 141 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 145 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 142 scoped_ptr<DeviceMonitorMac> device_monitor_mac_; | 146 scoped_ptr<DeviceMonitorMac> device_monitor_mac_; |
| 143 #endif | 147 #endif |
| 148 // The startup task runner is created by CreateStartupTasks() |
| 149 scoped_ptr<StartupTaskRunner> startup_task_runner_; |
| 144 | 150 |
| 145 // Destroy parts_ before main_message_loop_ (required) and before other | 151 // Destroy parts_ before main_message_loop_ (required) and before other |
| 146 // classes constructed in content (but after main_thread_). | 152 // classes constructed in content (but after main_thread_). |
| 147 scoped_ptr<BrowserMainParts> parts_; | 153 scoped_ptr<BrowserMainParts> parts_; |
| 148 | 154 |
| 149 // Members initialized in |InitializeMainThread()| --------------------------- | 155 // Members initialized in |InitializeMainThread()| --------------------------- |
| 150 // This must get destroyed before other threads that are created in parts_. | 156 // This must get destroyed before other threads that are created in parts_. |
| 151 scoped_ptr<BrowserThreadImpl> main_thread_; | 157 scoped_ptr<BrowserThreadImpl> main_thread_; |
| 152 | 158 |
| 153 // Members initialized in |BrowserThreadsStarted()| -------------------------- | 159 // Members initialized in |BrowserThreadsStarted()| -------------------------- |
| (...skipping 10 matching lines...) Expand all Loading... |
| 164 scoped_ptr<base::Thread> indexed_db_thread_; | 170 scoped_ptr<base::Thread> indexed_db_thread_; |
| 165 scoped_ptr<MemoryObserver> memory_observer_; | 171 scoped_ptr<MemoryObserver> memory_observer_; |
| 166 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; | 172 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; |
| 167 | 173 |
| 168 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 174 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 169 }; | 175 }; |
| 170 | 176 |
| 171 } // namespace content | 177 } // namespace content |
| 172 | 178 |
| 173 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 179 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| OLD | NEW |