chromium/components/page_load_metrics/browser/observers/ad_metrics/frame_tree_data.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/page_load_metrics/browser/observers/ad_metrics/frame_tree_data.h"

#include <algorithm>
#include <limits>
#include <string>

#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "components/heavy_ad_intervention/heavy_ad_features.h"
#include "components/page_load_metrics/browser/observers/ad_metrics/ads_page_load_metrics_observer.h"
#include "components/page_load_metrics/browser/observers/ad_metrics/frame_data_utils.h"
#include "components/page_load_metrics/common/page_load_metrics.mojom.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "url/gurl.h"

namespace page_load_metrics {

namespace {

// A frame with area less than kMinimumVisibleFrameArea is not considered
// visible.
const int kMinimumVisibleFrameArea =;

// Controls what types of heavy ads will be unloaded by the intervention.
const base::FeatureParam<int> kHeavyAdUnloadPolicyParam =;

// Calculates the depth from the outermost main page to the given `rfh` beyond
// page boundaries. This is used to ensure that the depth in the created tree is
// same with the actual page/frame tree structure.
unsigned int GetFullFrameDepth(content::RenderFrameHost* rfh) {}

}  // namespace

FrameTreeData::FrameTreeData(FrameTreeNodeId root_frame_tree_node_id,
                             int heavy_ad_network_threshold_noise)
    :{}

FrameTreeData::~FrameTreeData() = default;

void FrameTreeData::MaybeUpdateFrameDepth(
    content::RenderFrameHost* render_frame_host) {}

void FrameTreeData::UpdateMemoryUsage(int64_t delta_bytes) {}

bool FrameTreeData::ShouldRecordFrameForMetrics() const {}

void FrameTreeData::RecordAdFrameLoadUkmEvent(ukm::SourceId source_id) const {}

OriginStatusWithThrottling
FrameTreeData::GetCreativeOriginStatusWithThrottling() const {}

void FrameTreeData::SetFirstEligibleToPaint(
    std::optional<base::TimeDelta> time_stamp) {}

bool FrameTreeData::SetEarliestFirstContentfulPaint(
    std::optional<base::TimeDelta> time_stamp) {}

void FrameTreeData::SetEarliestFirstContentfulPaintSinceTopNavStart(
    base::TimeDelta time_since_top_nav_start) {}

void FrameTreeData::UpdateFrameVisibility() {}

HeavyAdStatus FrameTreeData::ComputeHeavyAdStatus(
    bool use_network_threshold_noise,
    HeavyAdUnloadPolicy policy) const {}

void FrameTreeData::UpdateCpuUsage(base::TimeTicks update_time,
                                   base::TimeDelta update) {}

base::TimeDelta FrameTreeData::GetTotalCpuUsage() const {}

void FrameTreeData::UpdateForNavigation(
    content::RenderFrameHost* render_frame_host) {}

void FrameTreeData::ProcessResourceLoadInFrame(
    const mojom::ResourceDataUpdatePtr& resource,
    int process_id,
    const ResourceTracker& resource_tracker) {}

void FrameTreeData::AdjustAdBytes(int64_t unaccounted_ad_bytes,
                                  ResourceMimeType mime_type) {}

void FrameTreeData::SetFrameSize(gfx::Size frame_size) {}

void FrameTreeData::SetDisplayState(bool is_display_none) {}

HeavyAdAction FrameTreeData::MaybeTriggerHeavyAdIntervention() {}

}  // namespace page_load_metrics