chromium/components/page_load_metrics/browser/observers/abandoned_page_load_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/abandoned_page_load_metrics_observer.h"

#include <string>

#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_process_host.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"

namespace {

AbandonReason;

AbandonReason DiscardReasonToAbandonReason(
    content::NavigationDiscardReason discard_reason) {}

bool IsEventAfter(base::TimeTicks event_time, base::TimeTicks time_to_compare) {}

}  // namespace

namespace internal {

const char kAbandonedPageLoadMetricsHistogramPrefix[] =;

const char kMilestoneToAbandon[] =;
const char kLastMilestoneBeforeAbandon[] =;
const char kTimeToAbandonFromNavigationStart[] =;

const char kAbandonReasonNewReloadNavigation[] =;
const char kAbandonReasonNewHistoryNavigation[] =;
const char kAbandonReasonNewOtherNavigationBrowserInitiated[] =;
const char kAbandonReasonNewOtherNavigationRendererInitiated[] =;
const char kAbandonReasonFrameRemoved[] =;
const char kAbandonReasonExplicitCancellation[] =;
const char kAbandonReasonInternalCancellation[] =;
const char kAbandonReasonRendererProcessGone[] =;
const char kAbandonReasonNeverStarted[] =;
const char kAbandonReasonFailedSecurityCheck[] =;
const char kAbandonReasonOther[] =;
const char kAbandonReasonHidden[] =;
const char kAbandonReasonErrorPage[] =;
const char kAbandonReasonAppBackgrounded[] =;

const char kSuffixWasBackgrounded[] =;
const char kSuffixWasHidden[] =;

const char kMilestoneNavigationStart[] =;
const char kMilestoneLoaderStart[] =;
const char kMilestoneFirstRedirectedRequestStart[] =;
const char kMilestoneFirstRedirectResponseStart[] =;
const char kMilestoneFirstRedirectResponseLoaderCallback[] =;
const char kMilestoneNonRedirectedRequestStart[] =;
const char kMilestoneNonRedirectResponseStart[] =;
const char kMilestoneNonRedirectResponseLoaderCallback[] =;
const char kMilestoneCommitSent[] =;
const char kMilestoneCommitReceived[] =;
const char kMilestoneDidCommit[] =;
const char kMilestoneParseStart[] =;
const char kFirstContentfulPaint[] =;
const char kDOMContentLoaded[] =;
const char kLoadEventStarted[] =;
const char kLargestContentfulPaint[] =;

const char kAFTStart[] =;
const char kAFTEnd[] =;
const char kHeaderChunkStart[] =;
const char kHeaderChunkEnd[] =;
const char kBodyChunkStart[] =;
const char kBodyChunkEnd[] =;

const char kRendererProcessCreatedBeforeNavHistogramName[] =;
const char kRendererProcessInitHistogramName[] =;

// TODO(https://crbug.com/347706997): Record more milestones related to loading
// and process creation timing.

}  // namespace internal

std::string AbandonedPageLoadMetricsObserver::AbandonReasonToString(
    AbandonReason abandon_reason) {}

std::string AbandonedPageLoadMetricsObserver::NavigationMilestoneToString(
    NavigationMilestone navigation_milestone) {}

AbandonedPageLoadMetricsObserver::AbandonedPageLoadMetricsObserver() = default;

AbandonedPageLoadMetricsObserver::~AbandonedPageLoadMetricsObserver() = default;

const char* AbandonedPageLoadMetricsObserver::GetObserverName() const {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnNavigationEvent(
    content::NavigationHandle* navigation_handle) {}

bool AbandonedPageLoadMetricsObserver::IsAllowedToLogMetrics() const {}

bool AbandonedPageLoadMetricsObserver::IsAllowedToLogUKM() const {}

std::string AbandonedPageLoadMetricsObserver::GetHistogramPrefix() const {}

std::vector<std::string>
AbandonedPageLoadMetricsObserver::GetAdditionalSuffixes() const {}

const base::flat_map<std::string,
                     AbandonedPageLoadMetricsObserver::NavigationMilestone>&
AbandonedPageLoadMetricsObserver::GetCustomUserTimingMarkNames() const {}

std::string AbandonedPageLoadMetricsObserver::GetHistogramSuffix(
    NavigationMilestone milestone,
    base::TimeTicks event_time) const {}

std::string AbandonedPageLoadMetricsObserver::
    GetMilestoneToAbandonHistogramNameWithoutPrefixSuffix(
        NavigationMilestone milestone,
        std::optional<AbandonReason> abandon_reason) {}

std::string AbandonedPageLoadMetricsObserver::
    GetAbandonReasonAtMilestoneHistogramNameWithoutPrefixSuffix(
        NavigationMilestone milestone) {}

std::string AbandonedPageLoadMetricsObserver::
    GetLastMilestoneBeforeAbandonHistogramNameWithoutPrefixSuffix(
        std::optional<AbandonReason> abandon_reason) {}

std::string
AbandonedPageLoadMetricsObserver::GetMilestoneHistogramNameWithoutPrefixSuffix(
    NavigationMilestone milestone) {}

std::string AbandonedPageLoadMetricsObserver::
    GetTimeToAbandonFromNavigationStartWithoutPrefixSuffix(
        NavigationMilestone milestone) {}

void AbandonedPageLoadMetricsObserver::LogMilestoneHistogram(
    NavigationMilestone milestone,
    base::TimeTicks event_time,
    base::TimeTicks relative_start_time) {}

void AbandonedPageLoadMetricsObserver::LogMilestoneHistogram(
    NavigationMilestone milestone,
    base::TimeDelta event_time) {}

void AbandonedPageLoadMetricsObserver::LogAbandonHistograms(
    AbandonReason abandon_reason,
    NavigationMilestone milestone,
    base::TimeTicks event_time,
    base::TimeTicks relative_start_time) {}

void AbandonedPageLoadMetricsObserver::LogLoadingMilestone(
    NavigationMilestone milestone,
    base::TimeDelta time) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnStart(
    content::NavigationHandle* navigation_handle,
    const GURL& currently_committed_url,
    bool started_in_foreground) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnRedirect(
    content::NavigationHandle* navigation_handle) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnNavigationHandleTimingUpdated(
    content::NavigationHandle* navigation_handle) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnCommit(
    content::NavigationHandle* navigation_handle) {}

void AbandonedPageLoadMetricsObserver::OnParseStart(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

void AbandonedPageLoadMetricsObserver::OnFirstContentfulPaintInPage(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

void AbandonedPageLoadMetricsObserver::OnDomContentLoadedEventStart(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

void AbandonedPageLoadMetricsObserver::OnLoadEventStart(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

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

void AbandonedPageLoadMetricsObserver::OnCustomUserTimingMarkObserved(
    const std::vector<page_load_metrics::mojom::CustomUserTimingMarkPtr>&
        timings) {}

void AbandonedPageLoadMetricsObserver::FinalizeLCP() {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnPrerenderStart(
    content::NavigationHandle* navigation_handle,
    const GURL& currently_committed_url) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnFencedFramesStart(
    content::NavigationHandle* navigation_handle,
    const GURL& currently_committed_url) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

page_load_metrics::PageLoadMetricsObserver::ObservePolicy
AbandonedPageLoadMetricsObserver::OnHidden(
    const page_load_metrics::mojom::PageLoadTiming& timing) {}

void AbandonedPageLoadMetricsObserver::LogPreviousHidingIfNeeded() {}
void AbandonedPageLoadMetricsObserver::LogPreviousBackgroundingIfNeeded() {}

void AbandonedPageLoadMetricsObserver::OnFailedProvisionalLoad(
    const page_load_metrics::FailedProvisionalLoadInfo&
        failed_provisional_load_info) {}

void AbandonedPageLoadMetricsObserver::OnDidInternalNavigationAbort(
    content::NavigationHandle* navigation_handle) {}

void AbandonedPageLoadMetricsObserver::LogMetricsOnAbandon(
    AbandonReason abandon_reason,
    base::TimeTicks abandon_timing) {}

void AbandonedPageLoadMetricsObserver::LogNavigationMilestoneMetrics() {}