Commit 05f56d41 authored by Primiano Tucci's avatar Primiano Tucci Committed by Commit Bot

allocator: remove ENABLE_MEMORY_TASK_PROFILER and use only USE_ALLOCATOR_SHIM

After the recent cleanup of crrev.com/2907563002, the flag
ENABLE_MEMORY_TASK_PROFILER became redundant and now is just
matching 1:1 USE_ALLOCATOR_SHIM. Use that instead.
No intended behavior change.
Also fix mistake of using defined(X) instead
of BUILDFLAG(X).

BUG=550886

Change-Id: I03a840b22861182208f1297a0c3f1152fd985c32
Reviewed-on: https://chromium-review.googlesource.com/520768
Commit-Queue: Primiano Tucci <primiano@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarSigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#476364}
parent 5fdd27d8
...@@ -37,11 +37,6 @@ declare_args() { ...@@ -37,11 +37,6 @@ declare_args() {
# details and the expected format. # details and the expected format.
override_build_date = "N/A" override_build_date = "N/A"
# Turn on memory profiling in the task profiler when the heap shim is
# available. Profiling can then be enabled at runtime by passing the command
# line flag --enable-heap-profiling=task-profiler.
enable_memory_task_profiler = use_allocator_shim
# Partition alloc is included by default except iOS. # Partition alloc is included by default except iOS.
use_partition_alloc = !is_ios use_partition_alloc = !is_ios
} }
...@@ -1684,7 +1679,6 @@ buildflag_header("debugging_flags") { ...@@ -1684,7 +1679,6 @@ buildflag_header("debugging_flags") {
header_dir = "base/debug" header_dir = "base/debug"
flags = [ flags = [
"ENABLE_PROFILING=$enable_profiling", "ENABLE_PROFILING=$enable_profiling",
"ENABLE_MEMORY_TASK_PROFILER=$enable_memory_task_profiler",
"CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers", "CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers",
] ]
} }
......
...@@ -23,7 +23,7 @@ namespace base { ...@@ -23,7 +23,7 @@ namespace base {
namespace allocator { namespace allocator {
bool IsAllocatorInitialized() { bool IsAllocatorInitialized() {
#if defined(OS_WIN) && defined(USE_ALLOCATOR_SHIM) #if defined(OS_WIN) && BUILDFLAG(USE_ALLOCATOR_SHIM)
// Set by allocator_shim_override_ucrt_symbols_win.h when the // Set by allocator_shim_override_ucrt_symbols_win.h when the
// shimmed _set_new_mode() is called. // shimmed _set_new_mode() is called.
return g_is_win_shim_layer_initialized; return g_is_win_shim_layer_initialized;
......
...@@ -213,13 +213,13 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() { ...@@ -213,13 +213,13 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
AllocationContextTracker::SetCaptureMode( AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::NATIVE_STACK); AllocationContextTracker::CaptureMode::NATIVE_STACK);
#endif // !defined(OS_NACL) #endif // !defined(OS_NACL)
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
} else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) { } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) {
// Enable heap tracking, which in turn enables capture of heap usage // Enable heap tracking, which in turn enables capture of heap usage
// tracking in tracked_objects.cc. // tracking in tracked_objects.cc.
if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled()) if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled())
base::debug::ThreadHeapUsageTracker::EnableHeapTracking(); base::debug::ThreadHeapUsageTracker::EnableHeapTracking();
#endif // BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #endif // BUILDFLAG(USE_ALLOCATOR_SHIM)
} else { } else {
LOG(FATAL) << "Invalid mode '" << profiling_mode << "' for " LOG(FATAL) << "Invalid mode '" << profiling_mode << "' for "
<< switches::kEnableHeapProfiling << " flag."; << switches::kEnableHeapProfiling << " flag.";
......
...@@ -699,7 +699,7 @@ void ThreadData::TallyADeath(const Births& births, ...@@ -699,7 +699,7 @@ void ThreadData::TallyADeath(const Births& births,
} // Release lock ASAP. } // Release lock ASAP.
death_data->RecordDurations(queue_duration, run_duration, random_number_); death_data->RecordDurations(queue_duration, run_duration, random_number_);
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
if (stopwatch.heap_tracking_enabled()) { if (stopwatch.heap_tracking_enabled()) {
base::debug::ThreadHeapUsage heap_usage = stopwatch.heap_usage().usage(); base::debug::ThreadHeapUsage heap_usage = stopwatch.heap_usage().usage();
// Saturate the 64 bit counts on conversion to 32 bit storage. // Saturate the 64 bit counts on conversion to 32 bit storage.
...@@ -1044,7 +1044,7 @@ TaskStopwatch::TaskStopwatch() ...@@ -1044,7 +1044,7 @@ TaskStopwatch::TaskStopwatch()
state_ = CREATED; state_ = CREATED;
child_ = NULL; child_ = NULL;
#endif #endif
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
heap_tracking_enabled_ = heap_tracking_enabled_ =
base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled(); base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled();
#endif #endif
...@@ -1064,7 +1064,7 @@ void TaskStopwatch::Start() { ...@@ -1064,7 +1064,7 @@ void TaskStopwatch::Start() {
#endif #endif
start_time_ = ThreadData::Now(); start_time_ = ThreadData::Now();
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
if (heap_tracking_enabled_) if (heap_tracking_enabled_)
heap_usage_.Start(); heap_usage_.Start();
#endif #endif
...@@ -1091,7 +1091,7 @@ void TaskStopwatch::Stop() { ...@@ -1091,7 +1091,7 @@ void TaskStopwatch::Stop() {
state_ = STOPPED; state_ = STOPPED;
DCHECK(child_ == NULL); DCHECK(child_ == NULL);
#endif #endif
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
if (heap_tracking_enabled_) if (heap_tracking_enabled_)
heap_usage_.Stop(true); heap_usage_.Stop(true);
#endif #endif
......
...@@ -853,7 +853,7 @@ class BASE_EXPORT TaskStopwatch { ...@@ -853,7 +853,7 @@ class BASE_EXPORT TaskStopwatch {
// this thread during that period. // this thread during that period.
int32_t RunDurationMs() const; int32_t RunDurationMs() const;
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
const base::debug::ThreadHeapUsageTracker& heap_usage() const { const base::debug::ThreadHeapUsageTracker& heap_usage() const {
return heap_usage_; return heap_usage_;
} }
...@@ -867,7 +867,7 @@ class BASE_EXPORT TaskStopwatch { ...@@ -867,7 +867,7 @@ class BASE_EXPORT TaskStopwatch {
// Time when the stopwatch was started. // Time when the stopwatch was started.
TrackedTime start_time_; TrackedTime start_time_;
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) #if BUILDFLAG(USE_ALLOCATOR_SHIM)
base::debug::ThreadHeapUsageTracker heap_usage_; base::debug::ThreadHeapUsageTracker heap_usage_;
bool heap_tracking_enabled_; bool heap_tracking_enabled_;
#endif #endif
......
...@@ -172,7 +172,6 @@ def build_gn_with_ninja_manually(tempdir, options): ...@@ -172,7 +172,6 @@ def build_gn_with_ninja_manually(tempdir, options):
write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h', write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
{ {
'ENABLE_PROFILING': 'false', 'ENABLE_PROFILING': 'false',
'ENABLE_MEMORY_TASK_PROFILER': 'false',
'CAN_UNWIND_WITH_FRAME_POINTERS': 'false' 'CAN_UNWIND_WITH_FRAME_POINTERS': 'false'
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment