blob: cf1f294d09abc6f8a111453ccc64b0b78cc722f7 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/tracing/background_memory_tracing_observer.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
namespace content {
// static
BackgroundMemoryTracingObserver*
BackgroundMemoryTracingObserver::GetInstance() {
static auto* instance = new BackgroundMemoryTracingObserver();
return instance;
}
BackgroundMemoryTracingObserver::BackgroundMemoryTracingObserver() {}
BackgroundMemoryTracingObserver::~BackgroundMemoryTracingObserver() {}
void BackgroundMemoryTracingObserver::OnScenarioActivated(
const BackgroundTracingConfigImpl* config) {}
void BackgroundMemoryTracingObserver::OnScenarioAborted() {}
void BackgroundMemoryTracingObserver::OnTracingEnabled(
BackgroundTracingConfigImpl::CategoryPreset preset) {
if (preset !=
BackgroundTracingConfigImpl::CategoryPreset::BENCHMARK_MEMORY_LIGHT)
return;
memory_instrumentation::MemoryInstrumentation::GetInstance()
->RequestGlobalDumpAndAppendToTrace(
base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND,
memory_instrumentation::MemoryInstrumentation::
RequestGlobalMemoryDumpAndAppendToTraceCallback());
}
} // namespace content