| 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/download/download_file_manager.h" | 19 #include "content/browser/download/download_file_manager.h" |
| 20 #include "content/browser/download/save_file_manager.h" | 20 #include "content/browser/download/save_file_manager.h" |
| 21 #include "content/browser/gamepad/gamepad_service.h" | 21 #include "content/browser/gamepad/gamepad_service.h" |
| 22 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 22 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 23 #include "content/browser/gpu/gpu_process_host.h" | 23 #include "content/browser/gpu/gpu_process_host.h" |
| 24 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 24 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 25 #include "content/browser/histogram_synchronizer.h" | 25 #include "content/browser/histogram_synchronizer.h" |
| 26 #include "content/browser/in_process_webkit/webkit_thread.h" | 26 #include "content/browser/in_process_webkit/webkit_thread.h" |
| 27 #include "content/browser/net/browser_online_state_observer.h" | 27 #include "content/browser/net/browser_online_state_observer.h" |
| 28 #include "content/browser/plugin_service_impl.h" | 28 #include "content/browser/plugin_service_impl.h" |
| 29 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | |
| 30 #include "content/browser/renderer_host/media/media_stream_manager.h" | 29 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 31 #include "content/browser/renderer_host/media/video_capture_manager.h" | |
| 32 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 30 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 33 #include "content/browser/speech/speech_recognition_manager_impl.h" | 31 #include "content/browser/speech/speech_recognition_manager_impl.h" |
| 34 #include "content/browser/trace_controller_impl.h" | 32 #include "content/browser/trace_controller_impl.h" |
| 35 #include "content/public/browser/browser_main_parts.h" | 33 #include "content/public/browser/browser_main_parts.h" |
| 36 #include "content/public/browser/browser_shutdown.h" | 34 #include "content/public/browser/browser_shutdown.h" |
| 37 #include "content/public/browser/content_browser_client.h" | 35 #include "content/public/browser/content_browser_client.h" |
| 38 #include "content/public/browser/gpu_data_manager.h" | 36 #include "content/public/browser/gpu_data_manager.h" |
| 39 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" |
| 40 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
| 41 #include "content/public/common/main_function_params.h" | 39 #include "content/public/common/main_function_params.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 audio_manager_.reset(media::AudioManager::Create()); | 334 audio_manager_.reset(media::AudioManager::Create()); |
| 337 | 335 |
| 338 #if !defined(OS_IOS) | 336 #if !defined(OS_IOS) |
| 339 // Start tracing to a file if needed. | 337 // Start tracing to a file if needed. |
| 340 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { | 338 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
| 341 TraceControllerImpl::GetInstance()->InitStartupTracing( | 339 TraceControllerImpl::GetInstance()->InitStartupTracing( |
| 342 parsed_command_line_); | 340 parsed_command_line_); |
| 343 } | 341 } |
| 344 | 342 |
| 345 online_state_observer_.reset(new BrowserOnlineStateObserver); | 343 online_state_observer_.reset(new BrowserOnlineStateObserver); |
| 346 scoped_refptr<media_stream::AudioInputDeviceManager> | 344 media_stream_manager_.reset( |
| 347 audio_input_device_manager( | 345 new media_stream::MediaStreamManager(audio_manager_.get())); |
| 348 new media_stream::AudioInputDeviceManager(audio_manager_.get())); | |
| 349 scoped_refptr<media_stream::VideoCaptureManager> video_capture_manager( | |
| 350 new media_stream::VideoCaptureManager()); | |
| 351 media_stream_manager_.reset(new media_stream::MediaStreamManager( | |
| 352 audio_input_device_manager, video_capture_manager)); | |
| 353 | 346 |
| 354 // Prior to any processing happening on the io thread, we create the | 347 // Prior to any processing happening on the io thread, we create the |
| 355 // plugin service as it is predominantly used from the io thread, | 348 // plugin service as it is predominantly used from the io thread, |
| 356 // but must be created on the main thread. The service ctor is | 349 // but must be created on the main thread. The service ctor is |
| 357 // inexpensive and does not invoke the io_thread() accessor. | 350 // inexpensive and does not invoke the io_thread() accessor. |
| 358 PluginService::GetInstance()->Init(); | 351 PluginService::GetInstance()->Init(); |
| 359 #endif // !defined(OS_IOS) | 352 #endif // !defined(OS_IOS) |
| 360 | 353 |
| 361 #if defined(OS_WIN) | 354 #if defined(OS_WIN) |
| 362 system_message_window_.reset(new SystemMessageWindowWin); | 355 system_message_window_.reset(new SystemMessageWindowWin); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 708 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 716 if (parameters_.ui_task) | 709 if (parameters_.ui_task) |
| 717 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 710 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 718 | 711 |
| 719 base::RunLoop run_loop; | 712 base::RunLoop run_loop; |
| 720 run_loop.Run(); | 713 run_loop.Run(); |
| 721 #endif | 714 #endif |
| 722 } | 715 } |
| 723 | 716 |
| 724 } // namespace content | 717 } // namespace content |
| OLD | NEW |