chromium/components/page_load_metrics/browser/page_load_metrics_memory_tracker.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/page_load_metrics/browser/page_load_metrics_memory_tracker.h"

#include <map>

#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

namespace features {

// Enables or disables per-frame memory monitoring.
BASE_FEATURE();

}  // namespace features

namespace page_load_metrics {

namespace {

// WeakPtrs cannot be used as the key to a map without a custom comparator, so
// we use a raw pointer for the map key and bundle the WeakPtr in a struct
// to be used as the value.
struct ObserverWeakPtrAndMemoryUpdates {};

}  // namespace

// Results of the V8PerAdFrameMemoryPollParamsStudy indicated that at the
// ~99.8th percentile, collecting at 10-second or 60-second intervals
// yields nearly equivalent results, as does using kBounded or kLazy mode.
// As there is about 10% to 20% overhead total GC time, we chose the less
// aggressive kLazy mode with a 60-second polling interval.
// For further results please see crbug.com/1116087.
PageLoadMetricsMemoryTracker::PageLoadMetricsMemoryTracker() {}

PageLoadMetricsMemoryTracker::~PageLoadMetricsMemoryTracker() = default;

void PageLoadMetricsMemoryTracker::Shutdown() {}

void PageLoadMetricsMemoryTracker::OnV8MemoryMeasurementAvailable(
    performance_manager::RenderProcessHostId render_process_host_id,
    const performance_manager::v8_memory::V8DetailedMemoryProcessData&
        process_data,
    const performance_manager::v8_memory::V8DetailedMemoryObserverAnySeq::
        FrameDataMap& frame_data) {}

void PageLoadMetricsMemoryTracker::OnRenderFrameDeleted(
    content::RenderFrameHost* render_frame_host,
    MetricsWebContentsObserver* observer) {}

int64_t PageLoadMetricsMemoryTracker::UpdateMemoryUsageAndGetDelta(
    content::RenderFrameHost* render_frame_host,
    uint64_t current_bytes_used) {}

}  // namespace page_load_metrics