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() {
# details and the expected format.
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.
use_partition_alloc = !is_ios
}
......@@ -1684,7 +1679,6 @@ buildflag_header("debugging_flags") {
header_dir = "base/debug"
flags = [
"ENABLE_PROFILING=$enable_profiling",
"ENABLE_MEMORY_TASK_PROFILER=$enable_memory_task_profiler",
"CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers",
]
}
......
......@@ -23,7 +23,7 @@ namespace base {
namespace allocator {
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
// shimmed _set_new_mode() is called.
return g_is_win_shim_layer_initialized;
......
......@@ -213,13 +213,13 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::NATIVE_STACK);
#endif // !defined(OS_NACL)
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
} else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) {
// Enable heap tracking, which in turn enables capture of heap usage
// tracking in tracked_objects.cc.
if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled())
base::debug::ThreadHeapUsageTracker::EnableHeapTracking();
#endif // BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM)
} else {
LOG(FATAL) << "Invalid mode '" << profiling_mode << "' for "
<< switches::kEnableHeapProfiling << " flag.";
......
......@@ -699,7 +699,7 @@ void ThreadData::TallyADeath(const Births& births,
} // Release lock ASAP.
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()) {
base::debug::ThreadHeapUsage heap_usage = stopwatch.heap_usage().usage();
// Saturate the 64 bit counts on conversion to 32 bit storage.
......@@ -1044,7 +1044,7 @@ TaskStopwatch::TaskStopwatch()
state_ = CREATED;
child_ = NULL;
#endif
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
heap_tracking_enabled_ =
base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled();
#endif
......@@ -1064,7 +1064,7 @@ void TaskStopwatch::Start() {
#endif
start_time_ = ThreadData::Now();
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
if (heap_tracking_enabled_)
heap_usage_.Start();
#endif
......@@ -1091,7 +1091,7 @@ void TaskStopwatch::Stop() {
state_ = STOPPED;
DCHECK(child_ == NULL);
#endif
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
if (heap_tracking_enabled_)
heap_usage_.Stop(true);
#endif
......
......@@ -853,7 +853,7 @@ class BASE_EXPORT TaskStopwatch {
// this thread during that period.
int32_t RunDurationMs() const;
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
const base::debug::ThreadHeapUsageTracker& heap_usage() const {
return heap_usage_;
}
......@@ -867,7 +867,7 @@ class BASE_EXPORT TaskStopwatch {
// Time when the stopwatch was started.
TrackedTime start_time_;
#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
base::debug::ThreadHeapUsageTracker heap_usage_;
bool heap_tracking_enabled_;
#endif
......
......@@ -172,7 +172,6 @@ def build_gn_with_ninja_manually(tempdir, options):
write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
{
'ENABLE_PROFILING': 'false',
'ENABLE_MEMORY_TASK_PROFILER': '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