| 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/power_monitor/power_monitor.h" |
| 16 #include "base/system_monitor/system_monitor.h" |
| 15 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 16 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 17 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 18 #include "content/browser/browser_thread_impl.h" | 20 #include "content/browser/browser_thread_impl.h" |
| 19 #include "content/browser/download/save_file_manager.h" | 21 #include "content/browser/download/save_file_manager.h" |
| 20 #include "content/browser/gamepad/gamepad_service.h" | 22 #include "content/browser/gamepad/gamepad_service.h" |
| 21 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 23 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 22 #include "content/browser/gpu/gpu_data_manager_impl.h" | 24 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 23 #include "content/browser/gpu/gpu_process_host.h" | 25 #include "content/browser/gpu/gpu_process_host.h" |
| 24 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 26 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 325 } |
| 324 #endif | 326 #endif |
| 325 | 327 |
| 326 // Create a MessageLoop if one does not already exist for the current thread. | 328 // Create a MessageLoop if one does not already exist for the current thread. |
| 327 if (!MessageLoop::current()) | 329 if (!MessageLoop::current()) |
| 328 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 330 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
| 329 | 331 |
| 330 InitializeMainThread(); | 332 InitializeMainThread(); |
| 331 | 333 |
| 332 system_monitor_.reset(new base::SystemMonitor); | 334 system_monitor_.reset(new base::SystemMonitor); |
| 335 power_monitor_.reset(new base::PowerMonitor); |
| 333 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | 336 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
| 334 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 337 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 335 audio_manager_.reset(media::AudioManager::Create()); | 338 audio_manager_.reset(media::AudioManager::Create()); |
| 336 | 339 |
| 337 #if !defined(OS_IOS) | 340 #if !defined(OS_IOS) |
| 338 // Start tracing to a file if needed. | 341 // Start tracing to a file if needed. |
| 339 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { | 342 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
| 340 TraceControllerImpl::GetInstance()->InitStartupTracing( | 343 TraceControllerImpl::GetInstance()->InitStartupTracing( |
| 341 parsed_command_line_); | 344 parsed_command_line_); |
| 342 } | 345 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 732 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 730 if (parameters_.ui_task) | 733 if (parameters_.ui_task) |
| 731 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 734 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 732 | 735 |
| 733 base::RunLoop run_loop; | 736 base::RunLoop run_loop; |
| 734 run_loop.Run(); | 737 run_loop.Run(); |
| 735 #endif | 738 #endif |
| 736 } | 739 } |
| 737 | 740 |
| 738 } // namespace content | 741 } // namespace content |
| OLD | NEW |