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

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 1391933004: [Tracing] Add hook to PartitionAlloc for heap profiling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jl comments Created 5 years, 2 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
« no previous file with comments | « no previous file | content/child/web_memory_dump_provider_adapter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/trace_event/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/trace_event/memory_dump_provider.h" 14 #include "base/trace_event/memory_dump_provider.h"
15 #include "base/trace_event/memory_dump_session_state.h" 15 #include "base/trace_event/memory_dump_session_state.h"
16 #include "base/trace_event/memory_profiler_allocation_context.h"
16 #include "base/trace_event/process_memory_dump.h" 17 #include "base/trace_event/process_memory_dump.h"
17 #include "base/trace_event/trace_event_argument.h" 18 #include "base/trace_event/trace_event_argument.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 20
20 #if !defined(OS_NACL) 21 #if !defined(OS_NACL)
21 #include "base/trace_event/process_memory_totals_dump_provider.h" 22 #include "base/trace_event/process_memory_totals_dump_provider.h"
22 #endif 23 #endif
23 24
24 #if defined(OS_LINUX) || defined(OS_ANDROID) 25 #if defined(OS_LINUX) || defined(OS_ANDROID)
25 #include "base/trace_event/malloc_dump_provider.h" 26 #include "base/trace_event/malloc_dump_provider.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 is_coordinator_(false), 108 is_coordinator_(false),
108 memory_tracing_enabled_(0), 109 memory_tracing_enabled_(0),
109 tracing_process_id_(kInvalidTracingProcessId), 110 tracing_process_id_(kInvalidTracingProcessId),
110 dumper_registrations_ignored_for_testing_(false) { 111 dumper_registrations_ignored_for_testing_(false) {
111 g_next_guid.GetNext(); // Make sure that first guid is not zero. 112 g_next_guid.GetNext(); // Make sure that first guid is not zero.
112 113
113 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess() 114 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess()
114 ? CommandLine::ForCurrentProcess()->HasSwitch( 115 ? CommandLine::ForCurrentProcess()->HasSwitch(
115 switches::kEnableHeapProfiling) 116 switches::kEnableHeapProfiling)
116 : false; 117 : false;
118
119 if (heap_profiling_enabled_)
120 AllocationContextTracker::SetCaptureEnabled(true);
117 } 121 }
118 122
119 MemoryDumpManager::~MemoryDumpManager() { 123 MemoryDumpManager::~MemoryDumpManager() {
120 TraceLog::GetInstance()->RemoveEnabledStateObserver(this); 124 TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
121 } 125 }
122 126
123 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, 127 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
124 bool is_coordinator) { 128 bool is_coordinator) {
125 { 129 {
126 AutoLock lock(lock_); 130 AutoLock lock(lock_);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 next_dump_provider(next_dump_provider), 518 next_dump_provider(next_dump_provider),
515 callback(callback), 519 callback(callback),
516 task_runner(MessageLoop::current()->task_runner()) { 520 task_runner(MessageLoop::current()->task_runner()) {
517 } 521 }
518 522
519 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { 523 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() {
520 } 524 }
521 525
522 } // namespace trace_event 526 } // namespace trace_event
523 } // namespace base 527 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | content/child/web_memory_dump_provider_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698