#include "components/performance_manager/public/v8_memory/v8_detailed_memory.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/observer_list.h"
#include "base/task/sequenced_task_runner.h"
#include "components/performance_manager/public/graph/frame_node.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/process_node.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/render_frame_host_proxy.h"
#include "components/performance_manager/public/render_process_host_id.h"
#include "components/performance_manager/public/v8_memory/v8_detailed_memory_any_seq.h"
#include "components/performance_manager/v8_memory/v8_detailed_memory_decorator.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/common/process_type.h"
namespace performance_manager {
namespace v8_memory {
namespace {
#if DCHECK_IS_ON()
bool g_test_eager_measurement_requests_enabled = …;
#endif
}
namespace internal {
void SetEagerMemoryMeasurementEnabledForTesting(bool enabled) { … }
}
V8DetailedMemoryRequest::V8DetailedMemoryRequest(
const base::TimeDelta& min_time_between_requests,
MeasurementMode mode)
: … { … }
V8DetailedMemoryRequest::V8DetailedMemoryRequest(
const base::TimeDelta& min_time_between_requests,
Graph* graph)
: … { … }
V8DetailedMemoryRequest::V8DetailedMemoryRequest(
const base::TimeDelta& min_time_between_requests,
MeasurementMode mode,
Graph* graph)
: … { … }
V8DetailedMemoryRequest::V8DetailedMemoryRequest(
base::PassKey<V8DetailedMemoryRequestAnySeq>,
const base::TimeDelta& min_time_between_requests,
MeasurementMode mode,
std::optional<base::WeakPtr<ProcessNode>> process_to_measure,
base::WeakPtr<V8DetailedMemoryRequestAnySeq> off_sequence_request)
: … { … }
V8DetailedMemoryRequest::V8DetailedMemoryRequest(
base::PassKey<V8DetailedMemoryRequestOneShot>,
MeasurementMode mode,
base::OnceClosure on_owner_unregistered_closure)
: … { … }
V8DetailedMemoryRequest::~V8DetailedMemoryRequest() { … }
void V8DetailedMemoryRequest::StartMeasurement(Graph* graph) { … }
void V8DetailedMemoryRequest::StartMeasurementForProcess(
const ProcessNode* process_node) { … }
void V8DetailedMemoryRequest::AddObserver(V8DetailedMemoryObserver* observer) { … }
void V8DetailedMemoryRequest::RemoveObserver(
V8DetailedMemoryObserver* observer) { … }
void V8DetailedMemoryRequest::OnOwnerUnregistered(
base::PassKey<V8DetailedMemoryRequestQueue>) { … }
void V8DetailedMemoryRequest::NotifyObserversOnMeasurementAvailable(
base::PassKey<V8DetailedMemoryRequestQueue>,
const ProcessNode* process_node) const { … }
void V8DetailedMemoryRequest::StartMeasurementFromOffSequence(
std::optional<base::WeakPtr<ProcessNode>> process_to_measure,
Graph* graph) { … }
void V8DetailedMemoryRequest::StartMeasurementImpl(
Graph* graph,
const ProcessNode* process_node) { … }
V8DetailedMemoryRequestOneShot::V8DetailedMemoryRequestOneShot(
MeasurementMode mode)
: … { … }
V8DetailedMemoryRequestOneShot::V8DetailedMemoryRequestOneShot(
const ProcessNode* process,
MeasurementCallback callback,
MeasurementMode mode)
: … { … }
V8DetailedMemoryRequestOneShot::~V8DetailedMemoryRequestOneShot() { … }
void V8DetailedMemoryRequestOneShot::StartMeasurement(
const ProcessNode* process,
MeasurementCallback callback) { … }
void V8DetailedMemoryRequestOneShot::OnV8MemoryMeasurementAvailable(
const ProcessNode* process_node,
const V8DetailedMemoryProcessData* process_data) { … }
V8DetailedMemoryRequestOneShot::V8DetailedMemoryRequestOneShot(
base::PassKey<V8DetailedMemoryRequestOneShotAnySeq>,
base::WeakPtr<ProcessNode> process,
MeasurementCallback callback,
MeasurementMode mode)
: … { … }
void V8DetailedMemoryRequestOneShot::InitializeRequest() { … }
void V8DetailedMemoryRequestOneShot::StartMeasurementFromOffSequence(
base::WeakPtr<ProcessNode> process,
MeasurementCallback callback) { … }
void V8DetailedMemoryRequestOneShot::DeleteRequest() { … }
void V8DetailedMemoryRequestOneShot::OnOwnerUnregistered() { … }
V8DetailedMemoryExecutionContextData::V8DetailedMemoryExecutionContextData() =
default;
V8DetailedMemoryExecutionContextData::~V8DetailedMemoryExecutionContextData() =
default;
V8DetailedMemoryExecutionContextData::V8DetailedMemoryExecutionContextData(
const V8DetailedMemoryExecutionContextData&) = default;
V8DetailedMemoryExecutionContextData::V8DetailedMemoryExecutionContextData(
V8DetailedMemoryExecutionContextData&&) = default;
V8DetailedMemoryExecutionContextData&
V8DetailedMemoryExecutionContextData::operator=(
const V8DetailedMemoryExecutionContextData&) = default;
V8DetailedMemoryExecutionContextData&
V8DetailedMemoryExecutionContextData::operator=(
V8DetailedMemoryExecutionContextData&&) = default;
const V8DetailedMemoryExecutionContextData*
V8DetailedMemoryExecutionContextData::ForFrameNode(const FrameNode* node) { … }
const V8DetailedMemoryExecutionContextData*
V8DetailedMemoryExecutionContextData::ForWorkerNode(const WorkerNode* node) { … }
const V8DetailedMemoryExecutionContextData*
V8DetailedMemoryExecutionContextData::ForExecutionContext(
const execution_context::ExecutionContext* ec) { … }
V8DetailedMemoryExecutionContextData*
V8DetailedMemoryExecutionContextData::CreateForTesting(const FrameNode* node) { … }
V8DetailedMemoryExecutionContextData*
V8DetailedMemoryExecutionContextData::CreateForTesting(const WorkerNode* node) { … }
const V8DetailedMemoryProcessData* V8DetailedMemoryProcessData::ForProcessNode(
const ProcessNode* node) { … }
V8DetailedMemoryProcessData* V8DetailedMemoryProcessData::GetOrCreateForTesting(
const ProcessNode* process_node) { … }
}
}