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

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

Issue 2902343002: Revert of memory-infra: LOG(FATAL) on unsupported heap profiler configs (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | 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 <inttypes.h> 7 #include <inttypes.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 void MemoryDumpManager::EnableHeapProfilingIfNeeded() { 195 void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
196 if (heap_profiling_enabled_) 196 if (heap_profiling_enabled_)
197 return; 197 return;
198 198
199 if (!CommandLine::InitializedForCurrentProcess() || 199 if (!CommandLine::InitializedForCurrentProcess() ||
200 !CommandLine::ForCurrentProcess()->HasSwitch( 200 !CommandLine::ForCurrentProcess()->HasSwitch(
201 switches::kEnableHeapProfiling)) 201 switches::kEnableHeapProfiling))
202 return; 202 return;
203 203
204 #if !BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM)
205 #if defined(OS_WIN)
206 const char kExtraErrMsg[] = "On Windows it requires release + static builds.";
207 #else
208 const char kExtraErrMsg[] = "";
209 #endif // defined(OS_WIN)
210 LOG(FATAL) << "--" << switches::kEnableHeapProfiling
211 << " requires building with use_experimental_allocator_shim=true "
212 "(on by default on the major platforms). "
213 << kExtraErrMsg;
214 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM)
215
216 std::string profiling_mode = CommandLine::ForCurrentProcess() 204 std::string profiling_mode = CommandLine::ForCurrentProcess()
217 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); 205 ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
218 if (profiling_mode == switches::kEnableHeapProfilingModePseudo) { 206 if (profiling_mode == switches::kEnableHeapProfilingModePseudo) {
219 AllocationContextTracker::SetCaptureMode( 207 AllocationContextTracker::SetCaptureMode(
220 AllocationContextTracker::CaptureMode::PSEUDO_STACK); 208 AllocationContextTracker::CaptureMode::PSEUDO_STACK);
221 #if !defined(OS_NACL) 209 #if !defined(OS_NACL)
222 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { 210 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
223 // If we don't have frame pointers then native tracing falls-back to 211 // If we don't have frame pointers then native tracing falls-back to
224 // using base::debug::StackTrace, which may be slow. 212 // using base::debug::StackTrace, which may be slow.
225 AllocationContextTracker::SetCaptureMode( 213 AllocationContextTracker::SetCaptureMode(
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 if (iter == process_dumps.end()) { 908 if (iter == process_dumps.end()) {
921 std::unique_ptr<ProcessMemoryDump> new_pmd( 909 std::unique_ptr<ProcessMemoryDump> new_pmd(
922 new ProcessMemoryDump(heap_profiler_serialization_state, dump_args)); 910 new ProcessMemoryDump(heap_profiler_serialization_state, dump_args));
923 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 911 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
924 } 912 }
925 return iter->second.get(); 913 return iter->second.get();
926 } 914 }
927 915
928 } // namespace trace_event 916 } // namespace trace_event
929 } // namespace base 917 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698