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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/pending_task.h" | 13 #include "base/pending_task.h" |
14 #include "base/power_monitor/power_monitor.h" | 14 #include "base/power_monitor/power_monitor.h" |
15 #include "base/power_monitor/power_monitor_device_source.h" | 15 #include "base/power_monitor/power_monitor_device_source.h" |
16 #include "base/process/process_metrics.h" | 16 #include "base/process/process_metrics.h" |
17 #include "base/profiler/scoped_profile.h" | 17 #include "base/profiler/scoped_profile.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/system_monitor/system_monitor.h" | 21 #include "base/system_monitor/system_monitor.h" |
22 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
24 #include "base/timer/hi_res_timer_manager.h" | 24 #include "base/timer/hi_res_timer_manager.h" |
25 #include "base/trace_event/memory_dump_manager.h" | 25 #include "base/trace_event/memory_dump_manager.h" |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "content/browser/browser_thread_impl.h" | 27 #include "content/browser/browser_thread_impl.h" |
28 #include "content/browser/device_sensors/device_inertial_sensor_service.h" | 28 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
| 29 #include "content/browser/dom_storage/dom_storage_area.h" |
29 #include "content/browser/download/save_file_manager.h" | 30 #include "content/browser/download/save_file_manager.h" |
30 #include "content/browser/gamepad/gamepad_service.h" | 31 #include "content/browser/gamepad/gamepad_service.h" |
31 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 32 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
32 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 33 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
33 #include "content/browser/gpu/compositor_util.h" | 34 #include "content/browser/gpu/compositor_util.h" |
34 #include "content/browser/gpu/gpu_data_manager_impl.h" | 35 #include "content/browser/gpu/gpu_data_manager_impl.h" |
35 #include "content/browser/gpu/gpu_process_host.h" | 36 #include "content/browser/gpu/gpu_process_host.h" |
36 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 37 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
37 #include "content/browser/histogram_synchronizer.h" | 38 #include "content/browser/histogram_synchronizer.h" |
38 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 39 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); | 607 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); |
607 } | 608 } |
608 #endif | 609 #endif |
609 | 610 |
610 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { | 611 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { |
611 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver"); | 612 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver"); |
612 memory_observer_.reset(new MemoryObserver()); | 613 memory_observer_.reset(new MemoryObserver()); |
613 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 614 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
614 } | 615 } |
615 | 616 |
| 617 if (parsed_command_line_.HasSwitch( |
| 618 switches::kEnableAggressiveDOMStorageFlushing)) { |
| 619 TRACE_EVENT0("startup", |
| 620 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); |
| 621 DOMStorageArea::EnableAggressiveCommitDelay(); |
| 622 } |
| 623 |
616 base::trace_event::MemoryDumpManager::GetInstance()->Initialize(); | 624 base::trace_event::MemoryDumpManager::GetInstance()->Initialize(); |
617 | 625 |
618 // Enable the dump providers. | 626 // Enable the dump providers. |
619 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 627 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
620 HostSharedBitmapManager::current()); | 628 HostSharedBitmapManager::current()); |
621 | 629 |
622 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 630 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
623 trace_memory_controller_.reset(new base::trace_event::TraceMemoryController( | 631 trace_memory_controller_.reset(new base::trace_event::TraceMemoryController( |
624 base::MessageLoop::current()->message_loop_proxy(), | 632 base::MessageLoop::current()->message_loop_proxy(), |
625 ::HeapProfilerWithPseudoStackStart, ::HeapProfilerStop, | 633 ::HeapProfilerWithPseudoStackStart, ::HeapProfilerStop, |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 | 1351 |
1344 void BrowserMainLoop::EndStartupTracing() { | 1352 void BrowserMainLoop::EndStartupTracing() { |
1345 is_tracing_startup_ = false; | 1353 is_tracing_startup_ = false; |
1346 TracingController::GetInstance()->DisableRecording( | 1354 TracingController::GetInstance()->DisableRecording( |
1347 TracingController::CreateFileSink( | 1355 TracingController::CreateFileSink( |
1348 startup_trace_file_, | 1356 startup_trace_file_, |
1349 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1357 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1350 } | 1358 } |
1351 | 1359 |
1352 } // namespace content | 1360 } // namespace content |
OLD | NEW |