blob: 5c19f2470f3793f63d7e11e4b7897ec50ad81825 [file] [log] [blame]
// Copyright 2016 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.
// Protocol buffers used for storing in SQLite.
// CAUTION: When any change is done here, bump kDatabaseVersion in
// resource_prefetch_predictor_tables.h.
syntax = "proto2";
package predictors;
// Required in Chrome.
option optimize_for = LITE_RUNTIME;
// Represents a single subresource.
message ResourceData {
// Mirrors content::ResourceType.
enum ResourceType {
RESOURCE_TYPE_MAIN_FRAME = 0;
RESOURCE_TYPE_SUB_FRAME = 1;
RESOURCE_TYPE_STYLESHEET = 2;
RESOURCE_TYPE_SCRIPT = 3;
RESOURCE_TYPE_IMAGE = 4;
RESOURCE_TYPE_FONT_RESOURCE = 5;
RESOURCE_TYPE_SUB_RESOURCE = 6;
RESOURCE_TYPE_OBJECT = 7;
RESOURCE_TYPE_MEDIA = 8;
RESOURCE_TYPE_WORKER = 9;
RESOURCE_TYPE_SHARED_WORKER = 10;
RESOURCE_TYPE_PREFETCH = 11;
RESOURCE_TYPE_FAVICON = 12;
RESOURCE_TYPE_XHR = 13;
RESOURCE_TYPE_PING = 14;
RESOURCE_TYPE_SERVICE_WORKER = 15;
RESOURCE_TYPE_CSP_REPORT = 16;
RESOURCE_TYPE_PLUGIN_RESOURCE = 17;
RESOURCE_TYPE_LAST_TYPE = 18;
}
// Mirrors net::RequestPriority
enum Priority {
REQUEST_PRIORITY_THROTTLED = 0;
REQUEST_PRIORITY_IDLE = 1;
REQUEST_PRIORITY_LOWEST = 2;
REQUEST_PRIORITY_LOW = 3;
REQUEST_PRIORITY_MEDIUM = 4;
REQUEST_PRIORITY_HIGHEST = 5;
}
optional string resource_url = 1;
optional ResourceType resource_type = 2;
optional uint32 number_of_hits = 3;
optional uint32 number_of_misses = 4;
optional uint32 consecutive_misses = 5;
optional double average_position = 6;
optional Priority priority = 7;
optional bool has_validators = 8;
optional bool always_revalidate = 9;
optional bool before_first_contentful_paint = 10;
}
// Represents a collection of subresources associated with URL or host.
message PrefetchData {
// Main frame URL of host.
optional string primary_key = 1;
optional uint64 last_visit_time = 2;
repeated ResourceData resources = 3;
}
// Represents a single redirect chain endpoint.
message RedirectStat {
// Represents the host for RedirectData in a host-based table.
optional string url = 1;
optional uint32 number_of_hits = 2;
optional uint32 number_of_misses = 3;
optional uint32 consecutive_misses = 4;
}
// Represents a mapping from URL or host to a list of redirect endpoints.
message RedirectData {
// Main frame URL or host.
optional string primary_key = 1;
optional uint64 last_visit_time = 2;
repeated RedirectStat redirect_endpoints = 3;
}
// Historical data for a single origin accessed from a host.
message OriginStat {
optional string origin = 1;
optional uint32 number_of_hits = 2;
optional uint32 number_of_misses = 3;
optional uint32 consecutive_misses = 4;
optional double average_position = 5;
optional bool always_access_network = 6;
optional bool accessed_network = 7;
}
// Collection of origins accessed from a host.
message OriginData {
optional string host = 1;
optional uint64 last_visit_time = 2;
repeated OriginStat origins = 3;
}