summaryrefslogtreecommitdiff
path: root/chromium/components/optimization_guide/proto/hints.proto
blob: da2efb7f8954648dc282a6ade27e26dd18bc45a0 (plain)
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
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";
option optimize_for = LITE_RUNTIME;

package optimization_guide.proto;

enum OptimizationType {
  TYPE_UNSPECIFIED = 0;
  // This optimization blocks Javascript on the page.
  NOSCRIPT = 1;
}

// Presents semantics for how page load URLs should be matched.
enum KeyRepresentation {
  REPRESENTATION_UNSPECIFIED = 0;
  // The suffix to match in the hostname of a page load URL.
  // Example: A host suffix of cnn.com would match pages with host
  // sports.cnn.com, but not foocnn.com.
  HOST_SUFFIX = 1;
}

message Optimization {
  // The type of optimization the hint applies to.
  optional OptimizationType optimization_type = 1;
  // A percent value to inflate the number of received bytes by for the purposes
  // of data savings calculations in the client.
  //
  // If this value is set to 0, the client should use its configured default.
  //
  // Ex: If the received bytes is 100 and the inflation_percent is 30, the
  // inflated bytes calculated by the client will be 30 in order to have a total
  // consumed bytes value of 130.
  optional int64 inflation_percent = 2;
}

message Hint {
  // Describes the granularity of the key field.
  optional KeyRepresentation key_representation = 1;
  // The key that applies to this hint. The key_representation field describes
  // the form in which this key takes. Guaranteed to be non-empty.
  optional string key = 2;
  // An unordered, non-empty set of optimizations that should be whitelisted for
  // this hint.
  repeated Optimization whitelisted_optimizations = 3;
}

message Configuration {
  // An unordered list containing hints for key/optimization combinations.
  // It is guaranteed that there will only be a single hint per key and key
  // representation combination. These hints are intended to apply to a full
  // page.
  //
  // Note, this list may contain multiple hints that apply to a page. For
  // example, if there are hints for (HOST_SUFFIX,cnn.com) and
  // (HOST_SUFFIX,sports.cnn.com), these may both apply to sports.cnn.com/foo.
  //
  // It is expected for the client to use the first match in this list.
  repeated Hint hints = 1;
}