#include "components/heap_profiling/multi_process/supervisor.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted_memory.h"
#include "base/no_destructor.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
#include "components/heap_profiling/multi_process/client_connection_manager.h"
#include "components/services/heap_profiling/heap_profiling_service.h"
#include "components/services/heap_profiling/public/cpp/controller.h"
#include "components/services/heap_profiling/public/cpp/settings.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_coordinator_service.h"
#include "content/public/browser/tracing_controller.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
namespace heap_profiling {
namespace {
base::trace_event::TraceConfig GetBackgroundTracingConfig(bool anonymize) { … }
}
Supervisor* Supervisor::GetInstance() { … }
Supervisor::Supervisor() = default;
Supervisor::~Supervisor() { … }
bool Supervisor::HasStarted() { … }
void Supervisor::SetClientConnectionManagerConstructor(
ClientConnectionManagerConstructor constructor) { … }
void Supervisor::Start(base::OnceClosure closure) { … }
void Supervisor::Start(Mode mode,
mojom::StackMode stack_mode,
uint32_t sampling_rate,
base::OnceClosure closure) { … }
void Supervisor::StartProfilingOnMemoryInfraThread(Mode mode,
mojom::StackMode stack_mode,
uint32_t sampling_rate,
base::OnceClosure closure) { … }
Mode Supervisor::GetMode() { … }
void Supervisor::StartManualProfiling(
base::ProcessId pid,
mojom::ProfilingService::AddProfilingClientCallback
started_profiling_closure) { … }
void Supervisor::GetProfiledPids(GetProfiledPidsCallback callback) { … }
uint32_t Supervisor::GetSamplingRate() { … }
void Supervisor::RequestTraceWithHeapDump(TraceFinishedCallback callback,
bool anonymize) { … }
void Supervisor::StartServiceOnIOThread(
mojo::PendingReceiver<memory_instrumentation::mojom::HeapProfiler> receiver,
mojo::PendingRemote<memory_instrumentation::mojom::HeapProfilerHelper>
remote_helper,
Mode mode,
mojom::StackMode stack_mode,
uint32_t sampling_rate,
base::OnceClosure closure) { … }
void Supervisor::FinishInitializationOnUIhread(
Mode mode,
base::OnceClosure closure,
base::WeakPtr<Controller> controller_weak_ptr) { … }
void Supervisor::GetProfiledPidsOnIOThread(GetProfiledPidsCallback callback) { … }
}