| 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 29 matching lines...) Expand all Loading... |
| 40 struct MainFunctionParams; | 40 struct MainFunctionParams; |
| 41 | 41 |
| 42 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) |
| 43 class DeviceMonitorLinux; | 43 class DeviceMonitorLinux; |
| 44 #elif defined(OS_MACOSX) | 44 #elif defined(OS_MACOSX) |
| 45 class DeviceMonitorMac; | 45 class DeviceMonitorMac; |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 // Implements the main browser loop stages called from BrowserMainRunner. | 48 // Implements the main browser loop stages called from BrowserMainRunner. |
| 49 // See comments in browser_main_parts.h for additional info. | 49 // See comments in browser_main_parts.h for additional info. |
| 50 // All functions are to be called only on the UI thread unless otherwise noted. | |
| 51 class BrowserMainLoop { | 50 class BrowserMainLoop { |
| 52 public: | 51 public: |
| 53 class MemoryObserver; | 52 // Returns the current instance. This is used to get access to the getters |
| 53 // that return objects which are owned by this class. |
| 54 static BrowserMainLoop* GetInstance(); |
| 55 |
| 54 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 56 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 55 virtual ~BrowserMainLoop(); | 57 virtual ~BrowserMainLoop(); |
| 56 | 58 |
| 57 void Init(); | 59 void Init(); |
| 58 | 60 |
| 59 void EarlyInitialization(); | 61 void EarlyInitialization(); |
| 60 void InitializeToolkit(); | 62 void InitializeToolkit(); |
| 61 void MainMessageLoopStart(); | 63 void MainMessageLoopStart(); |
| 62 | 64 |
| 63 // Create all secondary threads. | 65 // Create all secondary threads. |
| 64 void CreateThreads(); | 66 void CreateThreads(); |
| 65 | 67 |
| 66 // Perform the default message loop run logic. | 68 // Perform the default message loop run logic. |
| 67 void RunMainMessageLoopParts(); | 69 void RunMainMessageLoopParts(); |
| 68 | 70 |
| 69 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 71 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
| 70 // through stopping threads to PostDestroyThreads. | 72 // through stopping threads to PostDestroyThreads. |
| 71 void ShutdownThreadsAndCleanUp(); | 73 void ShutdownThreadsAndCleanUp(); |
| 72 | 74 |
| 73 int GetResultCode() const { return result_code_; } | 75 int GetResultCode() const { return result_code_; } |
| 74 | 76 |
| 75 // Can be called on any thread. | 77 media::AudioManager* audio_manager() const { return audio_manager_.get(); } |
| 76 static media::AudioManager* GetAudioManager(); | 78 AudioMirroringManager* audio_mirroring_manager() const { |
| 77 static AudioMirroringManager* GetAudioMirroringManager(); | 79 return audio_mirroring_manager_.get(); |
| 78 static MediaStreamManager* GetMediaStreamManager(); | 80 } |
| 81 MediaStreamManager* media_stream_manager() const { |
| 82 return media_stream_manager_.get(); |
| 83 } |
| 79 | 84 |
| 80 private: | 85 private: |
| 86 class MemoryObserver; |
| 81 // For ShutdownThreadsAndCleanUp. | 87 // For ShutdownThreadsAndCleanUp. |
| 82 friend class BrowserShutdownImpl; | 88 friend class BrowserShutdownImpl; |
| 83 | 89 |
| 84 void InitializeMainThread(); | 90 void InitializeMainThread(); |
| 85 | 91 |
| 86 // Called right after the browser threads have been started. | 92 // Called right after the browser threads have been started. |
| 87 void BrowserThreadsStarted(); | 93 void BrowserThreadsStarted(); |
| 88 | 94 |
| 89 void MainMessageLoopRun(); | 95 void MainMessageLoopRun(); |
| 90 | 96 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 scoped_ptr<BrowserProcessSubThread> cache_thread_; | 141 scoped_ptr<BrowserProcessSubThread> cache_thread_; |
| 136 scoped_ptr<BrowserProcessSubThread> io_thread_; | 142 scoped_ptr<BrowserProcessSubThread> io_thread_; |
| 137 scoped_ptr<MemoryObserver> memory_observer_; | 143 scoped_ptr<MemoryObserver> memory_observer_; |
| 138 | 144 |
| 139 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 145 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 140 }; | 146 }; |
| 141 | 147 |
| 142 } // namespace content | 148 } // namespace content |
| 143 | 149 |
| 144 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 150 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| OLD | NEW |