chromium/components/page_load_metrics/browser/observers/performance_manager_metrics_observer.cc

// Copyright 2024 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/observers/performance_manager_metrics_observer.h"

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/sequence_checker.h"
#include "base/strings/strcat.h"
#include "base/task/bind_post_task.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/observers/core/largest_contentful_paint_handler.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer_delegate.h"
#include "components/page_load_metrics/common/page_load_metrics.mojom.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/graph_registered.h"
#include "components/performance_manager/public/graph/page_node.h"
#include "components/performance_manager/public/performance_manager.h"
#include "content/public/browser/web_contents.h"

namespace {

ObservePolicy;
Visibility;
Graph;
PageNode;
PerformanceManager;

constexpr char kLCPToLoadedIdleHistogram[] =;
constexpr char kLCPWithoutLoadedIdleHistogram[] =;
constexpr char kLoadedIdleWithoutLCPHistogram[] =;

class LoadedIdleObserver final
    : public PageNode::ObserverDefaultImpl,
      public performance_manager::GraphOwnedAndRegistered<LoadedIdleObserver> {};

// static
LoadedIdleObserver& LoadedIdleObserver::GetOrCreate(Graph* graph) {}

void LoadedIdleObserver::AddWatchedPageNode(
    base::WeakPtr<PageNode> page_node,
    base::OnceCallback<void(base::TimeTicks)> on_loaded_idle_callback) {}

void LoadedIdleObserver::OnLoadingStateChanged(const PageNode* page_node,
                                               PageNode::LoadingState) {}

void LoadedIdleObserver::OnBeforePageNodeRemoved(const PageNode* page_node) {}

void LoadedIdleObserver::OnPassedToGraph(Graph* graph) {}

void LoadedIdleObserver::OnTakenFromGraph(Graph* graph) {}

void WatchLoadedIdleObserver(
    base::WeakPtr<PageNode> page_node,
    base::OnceCallback<void(base::TimeTicks)> on_loaded_idle_callback,
    Graph* graph) {}

const char* GetVisibilitySuffix(Visibility visibility) {}

}  // namespace

PerformanceManagerMetricsObserver::PerformanceManagerMetricsObserver() =
    default;

PerformanceManagerMetricsObserver::~PerformanceManagerMetricsObserver() =
    default;

void PerformanceManagerMetricsObserver::OnPageNodeLoadedIdle(
    base::TimeTicks loaded_idle_time) {}

ObservePolicy PerformanceManagerMetricsObserver::OnStart(
    content::NavigationHandle*,
    const GURL&,
    bool started_in_foreground) {}

ObservePolicy PerformanceManagerMetricsObserver::OnFencedFramesStart(
    content::NavigationHandle*,
    const GURL&) {}

ObservePolicy PerformanceManagerMetricsObserver::OnPrerenderStart(
    content::NavigationHandle*,
    const GURL&) {}

ObservePolicy PerformanceManagerMetricsObserver::OnHidden(
    const page_load_metrics::mojom::PageLoadTiming&) {}

ObservePolicy PerformanceManagerMetricsObserver::OnShown() {}

ObservePolicy
PerformanceManagerMetricsObserver::FlushMetricsOnAppEnterBackground(
    const page_load_metrics::mojom::PageLoadTiming&) {}

void PerformanceManagerMetricsObserver::OnComplete(
    const page_load_metrics::mojom::PageLoadTiming&) {}

void PerformanceManagerMetricsObserver::OnFailedProvisionalLoad(
    const page_load_metrics::FailedProvisionalLoadInfo&) {}

ObservePolicy PerformanceManagerMetricsObserver::LogMetricsIfLoaded(
    bool is_final) {}

void PerformanceManagerMetricsObserver::WatchForLoadedIdle(
    base::WeakPtr<PageNode> page_node) {}