| 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/browser/browser_main_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 namespace debug { | 21 namespace debug { |
| 20 class TraceMemoryController; | 22 class TraceMemoryController; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 60 |
| 59 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 61 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 60 virtual ~BrowserMainLoop(); | 62 virtual ~BrowserMainLoop(); |
| 61 | 63 |
| 62 void Init(); | 64 void Init(); |
| 63 | 65 |
| 64 void EarlyInitialization(); | 66 void EarlyInitialization(); |
| 65 void InitializeToolkit(); | 67 void InitializeToolkit(); |
| 66 void MainMessageLoopStart(); | 68 void MainMessageLoopStart(); |
| 67 | 69 |
| 68 // Create all secondary threads. | 70 // Create the tasks we need to complete startup. |
| 69 void CreateThreads(); | 71 void CreateStartupTasks(); |
| 70 | 72 |
| 71 // Perform the default message loop run logic. | 73 // Perform the default message loop run logic. |
| 72 void RunMainMessageLoopParts(); | 74 void RunMainMessageLoopParts(); |
| 73 | 75 |
| 74 // Performs the shutdown sequence, starting with PostMainMessageLoopRun | 76 // Performs the shutdown sequence, starting with PostMainMessageLoopRun |
| 75 // through stopping threads to PostDestroyThreads. | 77 // through stopping threads to PostDestroyThreads. |
| 76 void ShutdownThreadsAndCleanUp(); | 78 void ShutdownThreadsAndCleanUp(); |
| 77 | 79 |
| 78 int GetResultCode() const { return result_code_; } | 80 int GetResultCode() const { return result_code_; } |
| 79 | 81 |
| 80 media::AudioManager* audio_manager() const { return audio_manager_.get(); } | 82 media::AudioManager* audio_manager() const { return audio_manager_.get(); } |
| 81 AudioMirroringManager* audio_mirroring_manager() const { | 83 AudioMirroringManager* audio_mirroring_manager() const { |
| 82 return audio_mirroring_manager_.get(); | 84 return audio_mirroring_manager_.get(); |
| 83 } | 85 } |
| 84 MediaStreamManager* media_stream_manager() const { | 86 MediaStreamManager* media_stream_manager() const { |
| 85 return media_stream_manager_.get(); | 87 return media_stream_manager_.get(); |
| 86 } | 88 } |
| 87 media::MIDIManager* midi_manager() const { return midi_manager_.get(); } | 89 media::MIDIManager* midi_manager() const { return midi_manager_.get(); } |
| 88 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } | 90 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } |
| 89 | 91 |
| 90 private: | 92 private: |
| 91 class MemoryObserver; | 93 class MemoryObserver; |
| 92 // For ShutdownThreadsAndCleanUp. | 94 // For ShutdownThreadsAndCleanUp. |
| 93 friend class BrowserShutdownImpl; | 95 friend class BrowserShutdownImpl; |
| 94 | 96 |
| 95 void InitializeMainThread(); | 97 void InitializeMainThread(); |
| 96 | 98 |
| 99 // Called just before creating the threads |
| 100 int PreCreateThreads(); |
| 101 |
| 102 // Create all secondary threads. |
| 103 int CreateThreads(); |
| 104 |
| 97 // Called right after the browser threads have been started. | 105 // Called right after the browser threads have been started. |
| 98 void BrowserThreadsStarted(); | 106 int BrowserThreadsStarted(); |
| 107 |
| 108 int PreMainMessageLoopRun(); |
| 99 | 109 |
| 100 void MainMessageLoopRun(); | 110 void MainMessageLoopRun(); |
| 101 | 111 |
| 102 // Members initialized on construction --------------------------------------- | 112 // Members initialized on construction --------------------------------------- |
| 103 const MainFunctionParams& parameters_; | 113 const MainFunctionParams& parameters_; |
| 104 const CommandLine& parsed_command_line_; | 114 const CommandLine& parsed_command_line_; |
| 105 int result_code_; | 115 int result_code_; |
| 116 // True if the non-UI threads were created. |
| 117 bool created_threads_; |
| 106 | 118 |
| 107 // Members initialized in |MainMessageLoopStart()| --------------------------- | 119 // Members initialized in |MainMessageLoopStart()| --------------------------- |
| 108 scoped_ptr<base::MessageLoop> main_message_loop_; | 120 scoped_ptr<base::MessageLoop> main_message_loop_; |
| 109 scoped_ptr<base::SystemMonitor> system_monitor_; | 121 scoped_ptr<base::SystemMonitor> system_monitor_; |
| 110 scoped_ptr<base::PowerMonitor> power_monitor_; | 122 scoped_ptr<base::PowerMonitor> power_monitor_; |
| 111 scoped_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; | 123 scoped_ptr<base::HighResolutionTimerManager> hi_res_timer_manager_; |
| 112 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 124 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
| 113 scoped_ptr<media::AudioManager> audio_manager_; | 125 scoped_ptr<media::AudioManager> audio_manager_; |
| 114 scoped_ptr<media::MIDIManager> midi_manager_; | 126 scoped_ptr<media::MIDIManager> midi_manager_; |
| 115 scoped_ptr<AudioMirroringManager> audio_mirroring_manager_; | 127 scoped_ptr<AudioMirroringManager> audio_mirroring_manager_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 146 scoped_ptr<base::Thread> indexed_db_thread_; | 158 scoped_ptr<base::Thread> indexed_db_thread_; |
| 147 scoped_ptr<MemoryObserver> memory_observer_; | 159 scoped_ptr<MemoryObserver> memory_observer_; |
| 148 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; | 160 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; |
| 149 | 161 |
| 150 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 162 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 151 }; | 163 }; |
| 152 | 164 |
| 153 } // namespace content | 165 } // namespace content |
| 154 | 166 |
| 155 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 167 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| OLD | NEW |