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" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
18 #include "content/browser/browser_thread_impl.h" | 19 #include "content/browser/browser_thread_impl.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_data_manager_impl.h" | 24 #include "content/browser/gpu/gpu_data_manager_impl.h" |
24 #include "content/browser/gpu/gpu_process_host.h" | 25 #include "content/browser/gpu/gpu_process_host.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 330 } |
330 #endif | 331 #endif |
331 | 332 |
332 // Create a MessageLoop if one does not already exist for the current thread. | 333 // Create a MessageLoop if one does not already exist for the current thread. |
333 if (!MessageLoop::current()) | 334 if (!MessageLoop::current()) |
334 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 335 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
335 | 336 |
336 InitializeMainThread(); | 337 InitializeMainThread(); |
337 | 338 |
338 system_monitor_.reset(new base::SystemMonitor); | 339 system_monitor_.reset(new base::SystemMonitor); |
| 340 power_monitor_.reset(new base::PowerMonitor); |
339 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | 341 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
340 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 342 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
341 audio_manager_.reset(media::AudioManager::Create()); | 343 audio_manager_.reset(media::AudioManager::Create()); |
342 | 344 |
343 #if !defined(OS_IOS) | 345 #if !defined(OS_IOS) |
344 // Start tracing to a file if needed. | 346 // Start tracing to a file if needed. |
345 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { | 347 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
346 TraceControllerImpl::GetInstance()->InitStartupTracing( | 348 TraceControllerImpl::GetInstance()->InitStartupTracing( |
347 parsed_command_line_); | 349 parsed_command_line_); |
348 } | 350 } |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 728 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
727 if (parameters_.ui_task) | 729 if (parameters_.ui_task) |
728 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 730 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
729 | 731 |
730 base::RunLoop run_loop; | 732 base::RunLoop run_loop; |
731 run_loop.Run(); | 733 run_loop.Run(); |
732 #endif | 734 #endif |
733 } | 735 } |
734 | 736 |
735 } // namespace content | 737 } // namespace content |
OLD | NEW |