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 #include "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 18 #include "content/browser/browser_thread_impl.h" | 18 #include "content/browser/browser_thread_impl.h" |
| 19 #include "content/browser/devices_monitor/devices_monitor.h" | |
| 19 #include "content/browser/download/download_file_manager.h" | 20 #include "content/browser/download/download_file_manager.h" |
| 20 #include "content/browser/download/save_file_manager.h" | 21 #include "content/browser/download/save_file_manager.h" |
| 21 #include "content/browser/gamepad/gamepad_service.h" | 22 #include "content/browser/gamepad/gamepad_service.h" |
| 22 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 23 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 23 #include "content/browser/gpu/gpu_process_host.h" | 24 #include "content/browser/gpu/gpu_process_host.h" |
| 24 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 25 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 25 #include "content/browser/histogram_synchronizer.h" | 26 #include "content/browser/histogram_synchronizer.h" |
| 26 #include "content/browser/in_process_webkit/webkit_thread.h" | 27 #include "content/browser/in_process_webkit/webkit_thread.h" |
| 27 #include "content/browser/net/browser_online_state_observer.h" | 28 #include "content/browser/net/browser_online_state_observer.h" |
| 28 #include "content/browser/plugin_service_impl.h" | 29 #include "content/browser/plugin_service_impl.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 212 |
| 212 // static | 213 // static |
| 213 media::AudioManager* BrowserMainLoop::GetAudioManager() { | 214 media::AudioManager* BrowserMainLoop::GetAudioManager() { |
| 214 return g_current_browser_main_loop->audio_manager_.get(); | 215 return g_current_browser_main_loop->audio_manager_.get(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 // static | 218 // static |
| 218 media_stream::MediaStreamManager* BrowserMainLoop::GetMediaStreamManager() { | 219 media_stream::MediaStreamManager* BrowserMainLoop::GetMediaStreamManager() { |
| 219 return g_current_browser_main_loop->media_stream_manager_.get(); | 220 return g_current_browser_main_loop->media_stream_manager_.get(); |
| 220 } | 221 } |
| 222 | |
| 223 // static | |
| 224 content::DevicesMonitor* BrowserMainLoop::GetDevicesMonitor() { | |
| 225 return g_current_browser_main_loop->devices_monitor_.get(); | |
| 226 } | |
| 221 // BrowserMainLoop construction / destruction ============================= | 227 // BrowserMainLoop construction / destruction ============================= |
| 222 | 228 |
| 223 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) | 229 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) |
| 224 : parameters_(parameters), | 230 : parameters_(parameters), |
| 225 parsed_command_line_(parameters.command_line), | 231 parsed_command_line_(parameters.command_line), |
| 226 result_code_(content::RESULT_CODE_NORMAL_EXIT) { | 232 result_code_(content::RESULT_CODE_NORMAL_EXIT) { |
| 227 DCHECK(!g_current_browser_main_loop); | 233 DCHECK(!g_current_browser_main_loop); |
| 228 g_current_browser_main_loop = this; | 234 g_current_browser_main_loop = this; |
| 229 } | 235 } |
| 230 | 236 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 audio_input_device_manager( | 343 audio_input_device_manager( |
| 338 new media_stream::AudioInputDeviceManager(audio_manager_.get())); | 344 new media_stream::AudioInputDeviceManager(audio_manager_.get())); |
| 339 scoped_refptr<media_stream::VideoCaptureManager> video_capture_manager( | 345 scoped_refptr<media_stream::VideoCaptureManager> video_capture_manager( |
| 340 new media_stream::VideoCaptureManager()); | 346 new media_stream::VideoCaptureManager()); |
| 341 media_stream_manager_.reset(new media_stream::MediaStreamManager( | 347 media_stream_manager_.reset(new media_stream::MediaStreamManager( |
| 342 audio_input_device_manager, video_capture_manager)); | 348 audio_input_device_manager, video_capture_manager)); |
| 343 | 349 |
| 344 #if defined(OS_WIN) | 350 #if defined(OS_WIN) |
| 345 system_message_window_.reset(new SystemMessageWindowWin); | 351 system_message_window_.reset(new SystemMessageWindowWin); |
| 346 #endif | 352 #endif |
| 353 devices_monitor_.reset(DevicesMonitor::Create()); | |
|
tommi (sloooow) - chröme
2012/07/30 11:07:03
inside an #else?
| |
| 347 | 354 |
| 348 // Prior to any processing happening on the io thread, we create the | 355 // Prior to any processing happening on the io thread, we create the |
| 349 // plugin service as it is predominantly used from the io thread, | 356 // plugin service as it is predominantly used from the io thread, |
| 350 // but must be created on the main thread. The service ctor is | 357 // but must be created on the main thread. The service ctor is |
| 351 // inexpensive and does not invoke the io_thread() accessor. | 358 // inexpensive and does not invoke the io_thread() accessor. |
| 352 PluginService::GetInstance()->Init(); | 359 PluginService::GetInstance()->Init(); |
| 353 | 360 |
| 354 if (parts_.get()) | 361 if (parts_.get()) |
| 355 parts_->PostMainMessageLoopStart(); | 362 parts_->PostMainMessageLoopStart(); |
| 356 } | 363 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 682 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 676 if (parameters_.ui_task) | 683 if (parameters_.ui_task) |
| 677 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 684 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 678 | 685 |
| 679 base::RunLoop run_loop; | 686 base::RunLoop run_loop; |
| 680 run_loop.Run(); | 687 run_loop.Run(); |
| 681 #endif | 688 #endif |
| 682 } | 689 } |
| 683 | 690 |
| 684 } // namespace content | 691 } // namespace content |
| OLD | NEW |