Commit 9e668c3e authored by Tarun Bansal's avatar Tarun Bansal Committed by Commit Bot

Update proto file for server hints

Change-Id: I7a2ca94e6778f93226b2a8c10faa7c62ea1a4235
BUG: 856240
Reviewed-on: https://chromium-review.googlesource.com/1114210Reviewed-by: default avatarDoug Arnett <dougarnett@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570867}
parent eef973b1
...@@ -11,17 +11,38 @@ enum OptimizationType { ...@@ -11,17 +11,38 @@ enum OptimizationType {
TYPE_UNSPECIFIED = 0; TYPE_UNSPECIFIED = 0;
// This optimization blocks Javascript on the page. // This optimization blocks Javascript on the page.
NOSCRIPT = 1; NOSCRIPT = 1;
// This optimization applies a set of ResourceLoadingHint(s) to load the
// page.
RESOURCE_LOADING = 2;
} }
// Presents semantics for how page load URLs should be matched. // Presents semantics for how page load URLs should be matched.
enum KeyRepresentation { enum KeyRepresentation {
REPRESENTATION_UNSPECIFIED = 0; REPRESENTATION_UNSPECIFIED = 0;
// The suffix to match in the hostname of a page load URL. // 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. // Example: A host suffix of example.com would match pages with host
// sports.example.com, but not fooexample.com.
HOST_SUFFIX = 1; HOST_SUFFIX = 1;
} }
enum LoadingOptimizationType {
LOADING_UNSPECIFIED = 0;
// The resource should not be loaded.
LOADING_BLOCK_RESOURCE = 1;
}
message ResourceLoadingHint {
// The pattern to match against the resource URL.
//
// The pattern may be a single substring to match against the URL or it may be
// an ordered set of substrings to match where the substrings are separated by
// the ‘*’ wildcard character (with an implicit ‘*’ at the beginning and end).
optional string resource_pattern = 1;
// The type of loading optimization to apply to the resource.
optional LoadingOptimizationType loading_optimization_type = 2;
}
message Optimization { message Optimization {
// The type of optimization the hint applies to. // The type of optimization the hint applies to.
optional OptimizationType optimization_type = 1; optional OptimizationType optimization_type = 1;
...@@ -34,6 +55,58 @@ message Optimization { ...@@ -34,6 +55,58 @@ message Optimization {
// inflated bytes calculated by the client will be 30 in order to have a total // inflated bytes calculated by the client will be 30 in order to have a total
// consumed bytes value of 130. // consumed bytes value of 130.
optional int64 inflation_percent = 2; optional int64 inflation_percent = 2;
// An ordered set of resource loading hints for OptimizationType
// RESOURCE_LOADING.
//
// Only the first ResourceLoadingHint record that matches a target resource
// URL will be applied to that resource.
repeated ResourceLoadingHint resource_loading_hints = 3;
}
// The possible effective connection type values.
//
// The values should match those of //net/nqe/effective_connection_type.h in the
// Chromium repository.
enum EffectiveConnectionType {
// Effective connection type reported when the network quality is unknown.
EFFECTIVE_CONNECTION_TYPE_UNKNOWN = 0;
// Effective connection type reported when the Internet is unreachable,
// either because the device does not have a connection or because the
// connection is too slow to be usable.
EFFECTIVE_CONNECTION_TYPE_OFFLINE = 1;
// Effective connection type reported when the network has the quality of a
// poor 2G connection.
EFFECTIVE_CONNECTION_TYPE_SLOW_2G = 2;
// Effective connection type reported when the network has the quality of a
// faster 2G connection.
EFFECTIVE_CONNECTION_TYPE_2G = 3;
// Effective connection type reported when the network has the quality of a
// 3G connection.
EFFECTIVE_CONNECTION_TYPE_3G = 4;
// Effective connection type reported when the network has the quality of a
// 4G connection.
EFFECTIVE_CONNECTION_TYPE_4G = 5;
}
message PageHint {
// The pattern to match against the committed page URL.
//
// The pattern may be a single substring to match against the full URL or it
// may be an ordered set of substrings to match where the substrings are
// separated by the ‘*’ wildcard character (with an implicit ‘*’ at the
// beginning and end).
optional string page_pattern = 1;
// The maximum effective connection type threshold for triggering the
// optimization associated with this hint.
optional EffectiveConnectionType max_ect_trigger = 2;
// An unordered set of optimizations that should be whitelisted for this
// page pattern.
repeated Optimization whitelisted_optimizations = 3;
} }
message Hint { message Hint {
...@@ -42,21 +115,33 @@ message Hint { ...@@ -42,21 +115,33 @@ message Hint {
// The key that applies to this hint. The key_representation field describes // The key that applies to this hint. The key_representation field describes
// the form in which this key takes. Guaranteed to be non-empty. // the form in which this key takes. Guaranteed to be non-empty.
optional string key = 2; optional string key = 2;
// An unordered, non-empty set of optimizations that should be whitelisted for // An unordered set of optimizations that should be whitelisted for this
// this hint. // hint.
// If empty, then no optimizations should be whitelisted (this allows for an
// earlier hint entry to act as an exception to a subsequently matching hint
// whitelist entry). If multiple optimizations or page_hints are provided, the
// client will decide which one to act on.
repeated Optimization whitelisted_optimizations = 3; repeated Optimization whitelisted_optimizations = 3;
// An ordered set of per-page hints. Only the first PageHint record
// that matches a committed page URL should be used for that page load.
repeated PageHint page_hints = 4;
} }
message Configuration { message Configuration {
// An unordered list containing hints for key/optimization combinations. // An ordered list containing hints for key/optimization combinations.
//
// It is guaranteed that there will only be a single hint per key and key // 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 // representation combination. These hints are intended to apply to a full
// page. // page.
// //
// Note, this list may contain multiple hints that apply to a page. For // Note, this list may contain multiple hints that apply to a page. For
// example, if there are hints for (HOST_SUFFIX,cnn.com) and // example, if there are hints for (HOST_SUFFIX,example.com) and
// (HOST_SUFFIX,sports.cnn.com), these may both apply to sports.cnn.com/foo. // (HOST_SUFFIX,sports.example.com), these may both apply to
// sports.example.com/foo.
// //
// It is expected for the client to use the first match in this list. // The client will use the first Hint record with a key that matches the
// main frame URL. Therefore, the server should provide all the hint
// details for that key that it wants to provide as the client will only
// look at that one record to decide which optimization to apply.
repeated Hint hints = 1; repeated Hint hints = 1;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment