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

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

Issue 1706163002: Refactoring: Remove an argument 'enabled' from onHeapProfilingEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | base/trace_event/memory_dump_provider.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 #include <utility> 8 #include <utility>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (heap_profiling_enabled_) 136 if (heap_profiling_enabled_)
137 return; 137 return;
138 138
139 if (!CommandLine::InitializedForCurrentProcess() || 139 if (!CommandLine::InitializedForCurrentProcess() ||
140 !CommandLine::ForCurrentProcess()->HasSwitch( 140 !CommandLine::ForCurrentProcess()->HasSwitch(
141 switches::kEnableHeapProfiling)) 141 switches::kEnableHeapProfiling))
142 return; 142 return;
143 143
144 AllocationContextTracker::SetCaptureEnabled(true); 144 AllocationContextTracker::SetCaptureEnabled(true);
145 for (auto mdp : dump_providers_) 145 for (auto mdp : dump_providers_)
146 mdp->dump_provider->OnHeapProfilingEnabled(true); 146 mdp->dump_provider->OnHeapProfilingEnabled();
147 heap_profiling_enabled_ = true; 147 heap_profiling_enabled_ = true;
148 } 148 }
149 149
150 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, 150 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
151 bool is_coordinator) { 151 bool is_coordinator) {
152 { 152 {
153 AutoLock lock(lock_); 153 AutoLock lock(lock_);
154 DCHECK(delegate); 154 DCHECK(delegate);
155 DCHECK(!delegate_); 155 DCHECK(!delegate_);
156 delegate_ = delegate; 156 delegate_ = delegate;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 { 195 {
196 AutoLock lock(lock_); 196 AutoLock lock(lock_);
197 bool already_registered = !dump_providers_.insert(mdpinfo).second; 197 bool already_registered = !dump_providers_.insert(mdpinfo).second;
198 // This actually happens in some tests which don't have a clean tear-down 198 // This actually happens in some tests which don't have a clean tear-down
199 // path for RenderThreadImpl::Init(). 199 // path for RenderThreadImpl::Init().
200 if (already_registered) 200 if (already_registered)
201 return; 201 return;
202 } 202 }
203 203
204 if (heap_profiling_enabled_) 204 if (heap_profiling_enabled_)
205 mdp->OnHeapProfilingEnabled(true); 205 mdp->OnHeapProfilingEnabled();
206 } 206 }
207 207
208 void MemoryDumpManager::RegisterDumpProvider( 208 void MemoryDumpManager::RegisterDumpProvider(
209 MemoryDumpProvider* mdp, 209 MemoryDumpProvider* mdp,
210 const char* name, 210 const char* name,
211 const scoped_refptr<SingleThreadTaskRunner>& task_runner) { 211 const scoped_refptr<SingleThreadTaskRunner>& task_runner) {
212 RegisterDumpProvider(mdp, name, task_runner, MemoryDumpProvider::Options()); 212 RegisterDumpProvider(mdp, name, task_runner, MemoryDumpProvider::Options());
213 } 213 }
214 214
215 void MemoryDumpManager::UnregisterDumpProvider(MemoryDumpProvider* mdp) { 215 void MemoryDumpManager::UnregisterDumpProvider(MemoryDumpProvider* mdp) {
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 auto iter = process_dumps.find(pid); 672 auto iter = process_dumps.find(pid);
673 if (iter == process_dumps.end()) { 673 if (iter == process_dumps.end()) {
674 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); 674 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state));
675 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 675 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
676 } 676 }
677 return iter->second.get(); 677 return iter->second.get();
678 } 678 }
679 679
680 } // namespace trace_event 680 } // namespace trace_event
681 } // namespace base 681 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698