| 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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/browser_process_sub_thread.h" | 11 #include "content/browser/browser_process_sub_thread.h" |
| 12 #include "content/public/common/startup_task_runner.h" |
| 11 | 13 |
| 12 class CommandLine; | 14 class CommandLine; |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class HighResolutionTimerManager; | 17 class HighResolutionTimerManager; |
| 16 class MessageLoop; | 18 class MessageLoop; |
| 17 class PowerMonitor; | 19 class PowerMonitor; |
| 18 class SystemMonitor; | 20 class SystemMonitor; |
| 19 } | 21 } |
| 20 | 22 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 58 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 57 virtual ~BrowserMainLoop(); | 59 virtual ~BrowserMainLoop(); |
| 58 | 60 |
| 59 void Init(); | 61 void Init(); |
| 60 | 62 |
| 61 void EarlyInitialization(); | 63 void EarlyInitialization(); |
| 62 void InitializeToolkit(); | 64 void InitializeToolkit(); |
| 63 void MainMessageLoopStart(); | 65 void MainMessageLoopStart(); |
| 64 | 66 |
| 65 // Create all secondary threads. | 67 // Create all secondary threads. |
| 66 void CreateThreads(); | 68 void CreateThreads(const scoped_refptr<StartupTaskRunner>& task_runner); |
| 67 | 69 |
| 68 // Perform the default message loop run logic. | 70 // Perform the default message loop run logic. |
| 69 void RunMainMessageLoopParts(); | 71 void RunMainMessageLoopParts(); |
| 70 | 72 |
| 71 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 73 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
| 72 // through stopping threads to PostDestroyThreads. | 74 // through stopping threads to PostDestroyThreads. |
| 73 void ShutdownThreadsAndCleanUp(); | 75 void ShutdownThreadsAndCleanUp(); |
| 74 | 76 |
| 75 int GetResultCode() const { return result_code_; } | 77 int GetResultCode() const { return result_code_; } |
| 76 | 78 |
| 77 media::AudioManager* audio_manager() const { return audio_manager_.get(); } | 79 media::AudioManager* audio_manager() const { return audio_manager_.get(); } |
| 78 AudioMirroringManager* audio_mirroring_manager() const { | 80 AudioMirroringManager* audio_mirroring_manager() const { |
| 79 return audio_mirroring_manager_.get(); | 81 return audio_mirroring_manager_.get(); |
| 80 } | 82 } |
| 81 MediaStreamManager* media_stream_manager() const { | 83 MediaStreamManager* media_stream_manager() const { |
| 82 return media_stream_manager_.get(); | 84 return media_stream_manager_.get(); |
| 83 } | 85 } |
| 84 media::MIDIManager* midi_manager() const { return midi_manager_.get(); } | 86 media::MIDIManager* midi_manager() const { return midi_manager_.get(); } |
| 85 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } | 87 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } |
| 86 | 88 |
| 87 private: | 89 private: |
| 88 class MemoryObserver; | 90 class MemoryObserver; |
| 89 // For ShutdownThreadsAndCleanUp. | 91 // For ShutdownThreadsAndCleanUp. |
| 90 friend class BrowserShutdownImpl; | 92 friend class BrowserShutdownImpl; |
| 91 | 93 |
| 92 void InitializeMainThread(); | 94 void InitializeMainThread(); |
| 93 | 95 |
| 96 // Called just before creating the threads |
| 97 void PreCreateThreads(); |
| 98 |
| 99 // Create a single thread. |
| 100 void CreateThread(size_t thread_id); |
| 101 |
| 94 // Called right after the browser threads have been started. | 102 // Called right after the browser threads have been started. |
| 95 void BrowserThreadsStarted(); | 103 void BrowserThreadsStarted(); |
| 96 | 104 |
| 105 void PreMainMessageLoopRun(); |
| 106 |
| 97 void MainMessageLoopRun(); | 107 void MainMessageLoopRun(); |
| 98 | 108 |
| 99 // Members initialized on construction --------------------------------------- | 109 // Members initialized on construction --------------------------------------- |
| 100 const MainFunctionParams& parameters_; | 110 const MainFunctionParams& parameters_; |
| 101 const CommandLine& parsed_command_line_; | 111 const CommandLine& parsed_command_line_; |
| 102 int result_code_; | 112 int result_code_; |
| 103 | 113 |
| 104 // Members initialized in |MainMessageLoopStart()| --------------------------- | 114 // Members initialized in |MainMessageLoopStart()| --------------------------- |
| 105 scoped_ptr<base::MessageLoop> main_message_loop_; | 115 scoped_ptr<base::MessageLoop> main_message_loop_; |
| 106 scoped_ptr<base::SystemMonitor> system_monitor_; | 116 scoped_ptr<base::SystemMonitor> system_monitor_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 scoped_ptr<BrowserProcessSubThread> io_thread_; | 152 scoped_ptr<BrowserProcessSubThread> io_thread_; |
| 143 scoped_ptr<base::Thread> indexed_db_thread_; | 153 scoped_ptr<base::Thread> indexed_db_thread_; |
| 144 scoped_ptr<MemoryObserver> memory_observer_; | 154 scoped_ptr<MemoryObserver> memory_observer_; |
| 145 | 155 |
| 146 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 156 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 147 }; | 157 }; |
| 148 | 158 |
| 149 } // namespace content | 159 } // namespace content |
| 150 | 160 |
| 151 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 161 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| OLD | NEW |