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/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/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/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/pending_task.h" | 16 #include "base/pending_task.h" |
17 #include "base/power_monitor/power_monitor.h" | 17 #include "base/power_monitor/power_monitor.h" |
18 #include "base/power_monitor/power_monitor_device_source.h" | 18 #include "base/power_monitor/power_monitor_device_source.h" |
19 #include "base/process/process_metrics.h" | 19 #include "base/process/process_metrics.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/system_monitor/system_monitor.h" | 22 #include "base/system_monitor/system_monitor.h" |
| 23 #include "base/thread_task_runner_handle.h" |
23 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
24 #include "base/timer/hi_res_timer_manager.h" | 25 #include "base/timer/hi_res_timer_manager.h" |
25 #include "content/browser/browser_thread_impl.h" | 26 #include "content/browser/browser_thread_impl.h" |
26 #include "content/browser/device_orientation/device_inertial_sensor_service.h" | 27 #include "content/browser/device_orientation/device_inertial_sensor_service.h" |
27 #include "content/browser/download/save_file_manager.h" | 28 #include "content/browser/download/save_file_manager.h" |
28 #include "content/browser/gamepad/gamepad_service.h" | 29 #include "content/browser/gamepad/gamepad_service.h" |
29 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 30 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
30 #include "content/browser/gpu/compositor_util.h" | 31 #include "content/browser/gpu/compositor_util.h" |
31 #include "content/browser/gpu/gpu_data_manager_impl.h" | 32 #include "content/browser/gpu/gpu_data_manager_impl.h" |
32 #include "content/browser/gpu/gpu_process_host.h" | 33 #include "content/browser/gpu/gpu_process_host.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { | 449 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
449 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracing") | 450 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracing") |
450 TraceControllerImpl::GetInstance()->InitStartupTracing( | 451 TraceControllerImpl::GetInstance()->InitStartupTracing( |
451 parsed_command_line_); | 452 parsed_command_line_); |
452 } | 453 } |
453 | 454 |
454 { | 455 { |
455 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:OnlineStateObserver") | 456 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:OnlineStateObserver") |
456 online_state_observer_.reset(new BrowserOnlineStateObserver); | 457 online_state_observer_.reset(new BrowserOnlineStateObserver); |
457 } | 458 } |
| 459 |
| 460 { |
| 461 system_stats_monitor_.reset(new base::debug::TraceEventSystemStatsMonitor( |
| 462 base::ThreadTaskRunnerHandle::Get())); |
| 463 } |
458 #endif // !defined(OS_IOS) | 464 #endif // !defined(OS_IOS) |
459 | 465 |
460 #if defined(OS_WIN) | 466 #if defined(OS_WIN) |
461 system_message_window_.reset(new SystemMessageWindowWin); | 467 system_message_window_.reset(new SystemMessageWindowWin); |
462 | 468 |
463 if (base::win::IsTSFAwareRequired()) { | 469 if (base::win::IsTSFAwareRequired()) { |
464 // Create a TSF message filter for the message loop. MessageLoop takes | 470 // Create a TSF message filter for the message loop. MessageLoop takes |
465 // ownership of the filter. | 471 // ownership of the filter. |
466 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 472 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
467 new base::win::TextServicesMessageFilter); | 473 new base::win::TextServicesMessageFilter); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 714 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
709 true)); | 715 true)); |
710 | 716 |
711 if (parts_) { | 717 if (parts_) { |
712 TRACE_EVENT0("shutdown", | 718 TRACE_EVENT0("shutdown", |
713 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 719 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
714 parts_->PostMainMessageLoopRun(); | 720 parts_->PostMainMessageLoopRun(); |
715 } | 721 } |
716 | 722 |
717 trace_memory_controller_.reset(); | 723 trace_memory_controller_.reset(); |
| 724 system_stats_monitor_.reset(); |
718 | 725 |
719 #if !defined(OS_IOS) | 726 #if !defined(OS_IOS) |
720 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 727 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
721 // delete related objects on the GPU thread. This must be done before | 728 // delete related objects on the GPU thread. This must be done before |
722 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 729 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
723 // processes so this has to happen before stopping the IO thread. | 730 // processes so this has to happen before stopping the IO thread. |
724 { | 731 { |
725 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 732 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
726 GpuProcessHostUIShim::DestroyAll(); | 733 GpuProcessHostUIShim::DestroyAll(); |
727 } | 734 } |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 if (parameters_.ui_task) | 1042 if (parameters_.ui_task) |
1036 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 1043 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
1037 *parameters_.ui_task); | 1044 *parameters_.ui_task); |
1038 | 1045 |
1039 base::RunLoop run_loop; | 1046 base::RunLoop run_loop; |
1040 run_loop.Run(); | 1047 run_loop.Run(); |
1041 #endif | 1048 #endif |
1042 } | 1049 } |
1043 | 1050 |
1044 } // namespace content | 1051 } // namespace content |
OLD | NEW |