Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/browser/browser_process_sub_thread.h" | 15 #include "content/browser/browser_process_sub_thread.h" |
| 16 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
| 17 #include "media/audio/audio_manager.h" | 17 #include "media/audio/audio_manager.h" |
| 18 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h" | |
| 18 | 19 |
| 19 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
| 20 namespace aura { | 21 namespace aura { |
| 21 class Env; | 22 class Env; |
| 22 } | 23 } |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class CommandLine; | 27 class CommandLine; |
| 27 class FilePath; | 28 class FilePath; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 // See comments in browser_main_parts.h for additional info. | 103 // See comments in browser_main_parts.h for additional info. |
| 103 class CONTENT_EXPORT BrowserMainLoop { | 104 class CONTENT_EXPORT BrowserMainLoop { |
| 104 public: | 105 public: |
| 105 // Returns the current instance. This is used to get access to the getters | 106 // Returns the current instance. This is used to get access to the getters |
| 106 // that return objects which are owned by this class. | 107 // that return objects which are owned by this class. |
| 107 static BrowserMainLoop* GetInstance(); | 108 static BrowserMainLoop* GetInstance(); |
| 108 | 109 |
| 109 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 110 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 110 virtual ~BrowserMainLoop(); | 111 virtual ~BrowserMainLoop(); |
| 111 | 112 |
| 113 // The getter method for memory_instrumentation_coordinator_. It has a | |
| 114 // static getter so that we can access it from all threads. GetInstace can be | |
| 115 // accessed from the UI thread, only. | |
| 116 static memory_instrumentation::CoordinatorImpl* | |
|
Primiano Tucci (use gerrit)
2017/03/13 21:31:10
hmm this seems a bit of an unprecedented pattern.
chiniforooshan
2017/03/14 16:06:36
The GPUProcessHost is created in the IO thread, no
jam
2017/03/15 17:14:45
BrowserMainLoop shouldn't be accessed on non-UI th
chiniforooshan
2017/03/15 18:27:30
I see. I was hoping to not use global variables in
| |
| 117 GetMemoryInstrumentationCoordinator(); | |
| 118 | |
| 112 void Init(); | 119 void Init(); |
| 113 | 120 |
| 114 void EarlyInitialization(); | 121 void EarlyInitialization(); |
| 115 | 122 |
| 116 // Initializes the toolkit. Returns whether the toolkit initialization was | 123 // Initializes the toolkit. Returns whether the toolkit initialization was |
| 117 // successful or not. | 124 // successful or not. |
| 118 bool InitializeToolkit(); | 125 bool InitializeToolkit(); |
| 119 | 126 |
| 120 void PreMainMessageLoopStart(); | 127 void PreMainMessageLoopStart(); |
| 121 void MainMessageLoopStart(); | 128 void MainMessageLoopStart(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 144 } | 151 } |
| 145 media::UserInputMonitor* user_input_monitor() const { | 152 media::UserInputMonitor* user_input_monitor() const { |
| 146 return user_input_monitor_.get(); | 153 return user_input_monitor_.get(); |
| 147 } | 154 } |
| 148 discardable_memory::DiscardableSharedMemoryManager* | 155 discardable_memory::DiscardableSharedMemoryManager* |
| 149 discardable_shared_memory_manager() const { | 156 discardable_shared_memory_manager() const { |
| 150 return discardable_shared_memory_manager_.get(); | 157 return discardable_shared_memory_manager_.get(); |
| 151 } | 158 } |
| 152 midi::MidiService* midi_service() const { return midi_service_.get(); } | 159 midi::MidiService* midi_service() const { return midi_service_.get(); } |
| 153 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } | 160 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } |
| 161 memory_instrumentation::CoordinatorImpl* memory_instrumentation_coordinator() | |
| 162 const { | |
| 163 return memory_instrumentation_coordinator_.get(); | |
| 164 } | |
| 154 | 165 |
| 155 bool is_tracing_startup_for_duration() const { | 166 bool is_tracing_startup_for_duration() const { |
| 156 return is_tracing_startup_for_duration_; | 167 return is_tracing_startup_for_duration_; |
| 157 } | 168 } |
| 158 | 169 |
| 159 const base::FilePath& startup_trace_file() const { | 170 const base::FilePath& startup_trace_file() const { |
| 160 return startup_trace_file_; | 171 return startup_trace_file_; |
| 161 } | 172 } |
| 162 | 173 |
| 163 void StopStartupTracingTimer(); | 174 void StopStartupTracingTimer(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; | 325 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
| 315 #endif | 326 #endif |
| 316 | 327 |
| 317 std::unique_ptr<LoaderDelegateImpl> loader_delegate_; | 328 std::unique_ptr<LoaderDelegateImpl> loader_delegate_; |
| 318 std::unique_ptr<ResourceDispatcherHostImpl> resource_dispatcher_host_; | 329 std::unique_ptr<ResourceDispatcherHostImpl> resource_dispatcher_host_; |
| 319 std::unique_ptr<MediaStreamManager> media_stream_manager_; | 330 std::unique_ptr<MediaStreamManager> media_stream_manager_; |
| 320 std::unique_ptr<SpeechRecognitionManagerImpl> speech_recognition_manager_; | 331 std::unique_ptr<SpeechRecognitionManagerImpl> speech_recognition_manager_; |
| 321 std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> | 332 std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> |
| 322 discardable_shared_memory_manager_; | 333 discardable_shared_memory_manager_; |
| 323 scoped_refptr<SaveFileManager> save_file_manager_; | 334 scoped_refptr<SaveFileManager> save_file_manager_; |
| 335 std::unique_ptr<memory_instrumentation::CoordinatorImpl> | |
| 336 memory_instrumentation_coordinator_; | |
| 324 | 337 |
| 325 // DO NOT add members here. Add them to the right categories above. | 338 // DO NOT add members here. Add them to the right categories above. |
| 326 | 339 |
| 327 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 340 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 328 }; | 341 }; |
| 329 | 342 |
| 330 } // namespace content | 343 } // namespace content |
| 331 | 344 |
| 332 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 345 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| OLD | NEW |