chromium/third_party/blink/public/mojom/frame/back_forward_cache_controller.mojom

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

module blink.mojom;

import "third_party/blink/public/mojom/script_source_location.mojom";
import "third_party/blink/public/mojom/navigation/renderer_eviction_reason.mojom";

// This struct contains detailed information about a WebSchedulerTrackedFeature.
struct BlockingDetails {
  // The index of WebSchedulerTrackedFeature; the value set must correspond to the
  // WebSchedulerTrackedFeature enum.
  // TODO(crbug.com/1522767): Use enum instead of uint32 or have validation to
  // really avoid unintended messages.
  uint32 feature;
  // The JavaScript source location of `feature`. This should be null when the
  // feature doesn't involve source location.
  ScriptSourceLocation? source;
};

// This interface defines back-forward cache related methods that will be
// invoked from the renderer process.
//
// Calls to any of the methods defined in this interface must be allowed while
// the frame is in the back-forward cache. Calls to other (associated) interface
// methods while the frame is in the back-forward cache are disallowed and may
// trigger a renderer kill, depending on policy.
interface BackForwardCacheControllerHost {
  // Evicts the page from the back/forward cache due to e.g., JavaScript
  // execution and network request redirect. If the reason is kJavaScriptExecution,
  // `source` should indicate the source location where the script executed. It should
  // be null otherwise.
  EvictFromBackForwardCache(RendererEvictionReason reason, ScriptSourceLocation? source);

  // Sent by the blink's FrameScheduler when a list of active features
  // the scheduler tracks changes.
  // `details` is the list of blocking features currently being used and their
  // information about where they were used in JavaScript.
  DidChangeBackForwardCacheDisablingFeatures(
    array<BlockingDetails> details);
};