Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3296)

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 2195503003: predictors: Add the request priority to the reource_prefetch_predictor DB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/predictors/resource_prefetch_predictor.cc
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index de5556469fb2ce7d6f81be575eb280c18e2b1a91..497a359675382ad9b1b6580fae3483bbed7f5ca5 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -357,18 +357,18 @@ content::ResourceType ResourcePrefetchPredictor::GetResourceTypeFromMimeType(
ResourcePrefetchPredictor::URLRequestSummary::URLRequestSummary()
: resource_type(content::RESOURCE_TYPE_LAST_TYPE),
- was_cached(false) {
-}
+ priority(net::IDLE),
+ was_cached(false) {}
ResourcePrefetchPredictor::URLRequestSummary::URLRequestSummary(
const URLRequestSummary& other)
- : navigation_id(other.navigation_id),
- resource_url(other.resource_url),
- resource_type(other.resource_type),
- mime_type(other.mime_type),
- was_cached(other.was_cached),
- redirect_url(other.redirect_url) {
-}
+ : navigation_id(other.navigation_id),
+ resource_url(other.resource_url),
+ resource_type(other.resource_type),
+ priority(other.priority),
+ mime_type(other.mime_type),
+ was_cached(other.was_cached),
+ redirect_url(other.redirect_url) {}
ResourcePrefetchPredictor::URLRequestSummary::~URLRequestSummary() {
}
@@ -941,6 +941,7 @@ void ResourcePrefetchPredictor::LearnNavigation(
row_to_add.resource_type = new_resources[i].resource_type;
row_to_add.number_of_hits = 1;
row_to_add.average_position = i + 1;
+ row_to_add.priority = new_resources[i].priority;
cache_entry->second.resources.push_back(row_to_add);
resources_seen.insert(new_resources[i].resource_url);
}
@@ -978,6 +979,8 @@ void ResourcePrefetchPredictor::LearnNavigation(
if (new_row.resource_type != content::RESOURCE_TYPE_LAST_TYPE)
old_row.resource_type = new_row.resource_type;
+ old_row.priority = new_row.priority;
+
int position = new_index[old_row.resource_url] + 1;
int total = old_row.number_of_hits + old_row.number_of_misses;
old_row.average_position =
@@ -999,6 +1002,7 @@ void ResourcePrefetchPredictor::LearnNavigation(
row_to_add.resource_type = summary.resource_type;
row_to_add.number_of_hits = 1;
row_to_add.average_position = i + 1;
+ row_to_add.priority = summary.priority;
old_resources.push_back(row_to_add);
// To ensure we dont add the same url twice.

Powered by Google App Engine
This is Rietveld 408576698