chromium/content/browser/process_internals/process_internals.mojom

// 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.

module mojom;

import "url/mojom/url.mojom";

// Describes the current process counts and limit.
struct ProcessCountInfo {
  // Soft limit on renderer processes.
  uint64 renderer_process_limit;

  // Total number of renderer processes.
  uint64 renderer_process_count_total;

  // Total number of renderer processes that actually count towards the limit,
  // possibly ignoring some of the total (e.g., to prevent extensions from using
  // up the limit).
  uint64 renderer_process_count_for_limit;
};

// Basic information describing a SiteInstance.
struct SiteInstanceInfo {
  int32 id;

  // ID of the SiteInstanceGroup this SiteInstance belongs to.
  int32 site_instance_group_id;

  // ID of the BrowsingInstance this SiteInstance belongs to.
  int32 browsing_instance_id;

  // Boolean indicating whether the SiteInstance's process is locked to a
  // specific URL.
  bool locked;

  url.mojom.Url? site_url;

  // The URL to which the SiteInstance's process is locked.
  url.mojom.Url? process_lock_url;

  // Specifies whether the SiteInstance requires an origin-keyed process. This
  // is true for opt-in origin isolation via the OriginAgentCluster header,
  // false otherwise.
  bool requires_origin_keyed_process;

  // Specifies if the SiteInstance is for sandboxed iframe isolation.
  bool is_sandbox_for_iframes;

  // Specifies whether this SiteInstance is for a <webview> guest.
  bool is_guest;

  // Specifies whether this SiteInstance is for a PDF.
  bool is_pdf;

  // If this SiteInstance uses a non-default StoragePartition, this specifies a
  // string representation of that StoragePartition.
  string? storage_partition;
};

// Basic information describing a frame and all of its subframes.
struct FrameInfo {
  int32 routing_id;
  int32 agent_scheduling_group_id;
  int32 process_id;

  SiteInstanceInfo site_instance;
  url.mojom.Url? last_committed_url;

  array<FrameInfo> subframes;

  enum Type { kActive, kBackForwardCache, kPrerender };
  Type type;
};

// Basic information describing a WebContents object and all frames that are
// in it.
struct WebContentsInfo {
  string title;
  FrameInfo root_frame;
  array<FrameInfo> bfcached_root_frames;
  array<FrameInfo> prerender_root_frames;
};

// Information about a currently active isolated origin, including the origin
// itself and a |source| string that describes how the origin was added.
struct IsolatedOriginInfo {
  string origin;
  string source;
};

// Interface used by chrome://process-internals to query data from the
// browser process.
interface ProcessInternalsHandler {

  // Returns information about the current process count and limit, across all
  // profiles.
  GetProcessCountInfo() => (ProcessCountInfo info);

  // Returns a string containing the currently active isolation modes.
  GetIsolationMode() => (string mode);

  // Returns a string containing the currently active process per site mode.
  GetProcessPerSiteMode() => (string mode);

  // Returns a list of user-triggered isolated origins, which are typically
  // saved when the user types a password into a corresponding site.  These
  // origins apply within the current profile only, they are preserved across
  // restarts, and they are cleared when the user clears browsing data.
  GetUserTriggeredIsolatedOrigins() => (array<string> isolated_origins);

  // Returns a list of web-triggered isolated origins, which are typically
  // added in response to heuristics triggered directly by web sites, such
  // as headers that suggest the site might benefit from isolation.  Like
  // user-triggered isolated origins, these isolated origins apply within
  // the current profile only, they are preserved across
  // restarts, and they are cleared when the user clears browsing data.
  GetWebTriggeredIsolatedOrigins() => (array<string> isolated_origins);

  // Returns a list of isolated origins that apply globally in all profiles.
  GetGloballyIsolatedOrigins() => (array<IsolatedOriginInfo> isolated_origins);

  // Returns an array of WebContentsInfo structs for all WebContents
  // associated with the profile in which this call is made.
  GetAllWebContentsInfo() => (array<WebContentsInfo> infos);
};