Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 1340013002: Add thread-local allocation context for tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/memory_pressure_monitor.h" 11 #include "base/memory/memory_pressure_monitor.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/pending_task.h" 14 #include "base/pending_task.h"
15 #include "base/power_monitor/power_monitor.h" 15 #include "base/power_monitor/power_monitor.h"
16 #include "base/power_monitor/power_monitor_device_source.h" 16 #include "base/power_monitor/power_monitor_device_source.h"
17 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
18 #include "base/profiler/scoped_profile.h" 18 #include "base/profiler/scoped_profile.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
23 #include "base/system_monitor/system_monitor.h" 23 #include "base/system_monitor/system_monitor.h"
24 #include "base/thread_task_runner_handle.h" 24 #include "base/thread_task_runner_handle.h"
25 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
26 #include "base/timer/hi_res_timer_manager.h" 26 #include "base/timer/hi_res_timer_manager.h"
27 #include "base/trace_event/memory_dump_manager.h" 27 #include "base/trace_event/memory_dump_manager.h"
28 #include "base/trace_event/pseudo_stack.h"
28 #include "base/trace_event/trace_event.h" 29 #include "base/trace_event/trace_event.h"
29 #include "components/tracing/trace_config_file.h" 30 #include "components/tracing/trace_config_file.h"
30 #include "components/tracing/tracing_switches.h" 31 #include "components/tracing/tracing_switches.h"
31 #include "content/browser/browser_thread_impl.h" 32 #include "content/browser/browser_thread_impl.h"
32 #include "content/browser/device_sensors/device_inertial_sensor_service.h" 33 #include "content/browser/device_sensors/device_inertial_sensor_service.h"
33 #include "content/browser/dom_storage/dom_storage_area.h" 34 #include "content/browser/dom_storage/dom_storage_area.h"
34 #include "content/browser/download/save_file_manager.h" 35 #include "content/browser/download/save_file_manager.h"
35 #include "content/browser/gamepad/gamepad_service.h" 36 #include "content/browser/gamepad/gamepad_service.h"
36 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 37 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
37 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 38 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); 644 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay");
644 DOMStorageArea::EnableAggressiveCommitDelay(); 645 DOMStorageArea::EnableAggressiveCommitDelay();
645 } 646 }
646 647
647 // Enable memory-infra dump providers. 648 // Enable memory-infra dump providers.
648 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 649 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
649 HostSharedBitmapManager::current()); 650 HostSharedBitmapManager::current());
650 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 651 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
651 skia::SkiaMemoryDumpProvider::GetInstance()); 652 skia::SkiaMemoryDumpProvider::GetInstance());
652 653
654 pseudo_stack_controller_.reset(
655 new base::trace_event::PseudoStackController());
656
653 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) 657 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
654 trace_memory_controller_.reset(new base::trace_event::TraceMemoryController( 658 trace_memory_controller_.reset(new base::trace_event::TraceMemoryController(
655 base::MessageLoop::current()->task_runner(), 659 base::MessageLoop::current()->task_runner(),
656 ::HeapProfilerWithPseudoStackStart, ::HeapProfilerStop, 660 ::HeapProfilerWithPseudoStackStart, ::HeapProfilerStop,
657 ::GetHeapProfile)); 661 ::GetHeapProfile));
658 #endif 662 #endif
659 } 663 }
660 664
661 int BrowserMainLoop::PreCreateThreads() { 665 int BrowserMainLoop::PreCreateThreads() {
662 if (parts_) { 666 if (parts_) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 if (parts_) { 927 if (parts_) {
924 TRACE_EVENT0("shutdown", 928 TRACE_EVENT0("shutdown",
925 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); 929 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun");
926 parts_->PostMainMessageLoopRun(); 930 parts_->PostMainMessageLoopRun();
927 } 931 }
928 932
929 #if defined(USE_AURA) 933 #if defined(USE_AURA)
930 aura::Env::DeleteInstance(); 934 aura::Env::DeleteInstance();
931 #endif 935 #endif
932 936
937 pseudo_stack_controller_.reset();
933 trace_memory_controller_.reset(); 938 trace_memory_controller_.reset();
934 system_stats_monitor_.reset(); 939 system_stats_monitor_.reset();
935 940
936 #if !defined(OS_IOS) 941 #if !defined(OS_IOS)
937 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to 942 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
938 // delete related objects on the GPU thread. This must be done before 943 // delete related objects on the GPU thread. This must be done before
939 // stopping the GPU thread. The GPU thread will close IPC channels to renderer 944 // stopping the GPU thread. The GPU thread will close IPC channels to renderer
940 // processes so this has to happen before stopping the IO thread. 945 // processes so this has to happen before stopping the IO thread.
941 { 946 {
942 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); 947 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim");
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 DCHECK(is_tracing_startup_for_duration_); 1385 DCHECK(is_tracing_startup_for_duration_);
1381 1386
1382 is_tracing_startup_for_duration_ = false; 1387 is_tracing_startup_for_duration_ = false;
1383 TracingController::GetInstance()->DisableRecording( 1388 TracingController::GetInstance()->DisableRecording(
1384 TracingController::CreateFileSink( 1389 TracingController::CreateFileSink(
1385 startup_trace_file_, 1390 startup_trace_file_,
1386 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1391 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1387 } 1392 }
1388 1393
1389 } // namespace content 1394 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698