File: site_data.mojom

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (90 lines) | stat: -rw-r--r-- 3,131 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// 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 discards.mojom;

struct SiteDataFeature {
  // The cumulative observation time for this feature in seconds, set to 0 once
  // this feature has been observed.
  int64 observation_duration;
  // The time at which this feature has been used (set to 0 if it hasn't been
  // used), in seconds since epoch.
  int64 use_timestamp;
};

struct SiteDataPerformanceMeasurement {
  // A decaying average of the CPU usage measurements. Units: microseconds.
  float avg_cpu_usage_us;
  // A decaying average of the process footprint measurements. Units: kilobytes.
  float avg_footprint_kb;
  // A decaying average of the wall-clock load time duration of the tab.
  // Units: microseconds.
  float avg_load_duration_us;
};

struct SiteDataDatabaseSize {
  // The total number of rows in the database, or -1 if the value is not
  // available.
  int64 num_rows;

  // The total size of the database on disk in kilobytes, or -1 if the value
  // is not available.
  int64 on_disk_size_kb;
};

// The data stored for a given origin, this should mirror the
// SiteDataProto structure in
// performance_manager/persistence/site_data/site_data.proto.
struct SiteDataValue {
  // The last time this site has been in the loaded state, in seconds since
  // epoch.
  uint32 last_loaded;

  SiteDataFeature updates_favicon_in_background;
  SiteDataFeature updates_title_in_background;
  SiteDataFeature uses_audio_in_background;

  // Load time performance measurement estimates. This maintains a decaying
  // average of the resource usage of a page until shortly after it becomes
  // idle.
  SiteDataPerformanceMeasurement? load_time_estimates;
};

// Provides the key and miscellaneous in-memory only data pertaining to a
// row that potentially exists in a database.
struct SiteDataEntry {
  // The origin associated with this row.
  string origin;

  // This row is pending flush to disk.
  bool is_dirty;

  // NULL if the database entry doesn't exist on disk or in memory.
  SiteDataValue? value;
};

// Contains information about a specific set of SiteData entries.
struct SiteDataArray {
  // Contains the entries requested.
  array<SiteDataEntry> db_rows;
};

// Interface for providing information about the site data database. Lives in
// the browser process and is invoked in the renderer process via Javascript
// code running in the chrome://discards WebUI.
interface SiteDataProvider {
  // Returns the in-memory entries and the entries for the requested origins.
  // Note that any entry may take some time to load from disk, and so there may
  // not be any data for a given entry until on the second or subsequent
  // requests.
  GetSiteDataArray(
      array<string> explicitly_requested_origins) =>
          (SiteDataArray? result);

  // Returns the size of the database in number of rows and kilobytes.
  // Note that this may be fairly expensive to acquire, and so shouldn't be
  // called frequently.
  GetSiteDataDatabaseSize() =>
      (SiteDataDatabaseSize? db_size);
};