Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ pyhindsight/static/web_modules/
.claude/
hindsight-temp/
data-sets/
/temp_outputs/
/temp_outputs/
/test-fixtures/
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright 2017 The Chromium Authors
// 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 download_pb;

import "components/download/database/proto/download_source.proto";

message HttpRequestHeader {
optional string key = 1;
optional string value = 2;
}

// Slice information for parallel downloading.
message ReceivedSlice {
optional int64 offset = 1;
optional int64 received_bytes = 2;
optional bool finished = 3;
}

// Stores various in-progress metadata related to a download.
message DownloadEntry {
optional string guid = 1;
optional string request_origin = 2;
optional DownloadSource download_source = 3;
optional int64 ukm_download_id = 4;
optional int64 bytes_wasted = 5;
optional bool fetch_error_body = 6;
repeated HttpRequestHeader request_headers = 7;
}

// Contains a list of entries.
message DownloadEntries {
repeated DownloadEntry entries = 1;
}

// Information for ukm reporting
message UkmInfo {
optional DownloadSource download_source = 1;
optional int64 ukm_download_id = 2;
}

// Information about when to start the download, used by download later feature.
// Deprecated.
message DownloadSchedule {
optional int64 start_time = 1;
}

// Information about an in progress download.
message InProgressInfo {
repeated string url_chain = 1;
optional string referrer_url = 2;
optional string site_url = 3; // deprecated
optional string tab_url = 4;
optional string tab_referrer_url = 5;
optional bool fetch_error_body = 6;
repeated HttpRequestHeader request_headers = 7;
optional string etag = 8;
optional string last_modified = 9;
optional int64 total_bytes = 10;
optional string mime_type = 11;
optional string original_mime_type = 12;
optional bytes current_path = 13; // Serialized pickles to support string16
optional bytes target_path = 14; // Serialized pickles to support string16
optional int64 received_bytes = 15;
optional int64 start_time = 16;
optional int64 end_time = 17;
repeated ReceivedSlice received_slices = 18;
optional bytes hash = 19; // Hindsight: upstream declares this `string` but it holds the
// raw binary SHA-256; `bytes` lets us extract/hex it cleanly.
optional bool transient = 20;
optional int32 state = 21;
optional int32 danger_type = 22;
optional int32 interrupt_reason = 23;
optional bool paused = 24;
optional bool metered = 25;
optional int64 bytes_wasted = 26;
optional int32 auto_resume_count = 27;
optional DownloadSchedule download_schedule = 28; // // Deprecated.
// Removing DownloadItemRerouteInfo since FileSystem Connector will not
// be released, implementation deleted.
reserved 29;
optional int32 credentials_mode = 30; // network::mojom::CredentialsMode
optional int64 range_request_from = 31;
optional int64 range_request_to = 32;
optional bytes serialized_embedder_download_data = 33; // Hindsight: upstream `string`,
// but holds a serialized content.proto.EmbedderDownloadData;
// `bytes` lets us FromString it cleanly.
reserved 34;
optional bool fetched_via_service_worker = 35;
}

// Stores various metadata related to a download.
// WIP and will replace DownloadEntry.
message DownloadInfo {
optional string guid = 1;
optional int32 id = 2;
optional UkmInfo ukm_info = 3;
optional InProgressInfo in_progress_info = 4;
}

// In progress database entry for download information.
message DownloadDBEntry {
// Add field for offline page download.
oneof entry { DownloadInfo download_info = 1; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2017 The Chromium Authors
// 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 download_pb;

// This should stay in sync with the download::DownloadSource enum in
// components/download/public/common/download_source.h.
enum DownloadSource {
UNKNOWN = 0;
NAVIGATION = 1;
DRAG_AND_DROP = 2;
FROM_RENDERER = 3;
EXTENSION_API = 4;
EXTENSION_INSTALLER = 5;
INTERNAL_API = 6;
WEB_CONTENTS_API = 7;
OFFLINE_PAGE = 8;
CONTEXT_MENU = 9;
RETRY = 10;
RETRY_FROM_BUBBLE = 11;
TOOLBAR_MENU = 12;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2019 The Chromium Authors
// 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;

// Contains the information that we want to track about a given site feature.
// Next Id: 3
message SiteDataFeatureProto {
// The cumulative observation time for this feature in seconds, set to 0 once
// this feature has been observed.
optional int64 observation_duration = 1;
// The time at which this feature has been used (set to 0 if it hasn't been
// used), in seconds since epoch.
optional int64 use_timestamp = 2;
}

// Contains decaying average performance measurement estimates.
// Next Id: 4
message SiteDataPerformanceMeasurement {
// A decaying average of the CPU usage measurements. Units: microseconds.
optional float avg_cpu_usage_us = 1;
// A decaying average of the process footprint measurements. Units: kilobytes.
optional float avg_footprint_kb = 2;
// A decaying average of the duration from navigation commit to "loaded".
// Units: microseconds.
optional float avg_load_duration_us = 3;
};

// Defines the data that we want to track about a given site.
// Next Id: 7
message SiteDataProto {
// The last time this site has been in the loaded state, in seconds since
// epoch.
optional uint32 last_loaded = 1;

// List of features that we're tracking.
optional SiteDataFeatureProto updates_favicon_in_background = 2;
optional SiteDataFeatureProto updates_title_in_background = 3;
optional SiteDataFeatureProto uses_audio_in_background = 4;
optional SiteDataFeatureProto deprecated_uses_notifications_in_background = 5;

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