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

Unified Diff: chrome/browser/net/resource_prefetch_predictor_observer.cc

Issue 10829195: Speculative resource prefetching - Not modify resource_type for MAIN_FRAME requests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing spacing. Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/resource_prefetch_predictor_observer.cc
diff --git a/chrome/browser/net/resource_prefetch_predictor_observer.cc b/chrome/browser/net/resource_prefetch_predictor_observer.cc
index 0de2c189a43e64bf2556898aa30599eedf51a6db..3ea85dce301159ffc72706fdb0c78a88f8339b13 100644
--- a/chrome/browser/net/resource_prefetch_predictor_observer.cc
+++ b/chrome/browser/net/resource_prefetch_predictor_observer.cc
@@ -40,12 +40,14 @@ bool SummarizeResponse(net::URLRequest* request,
request->GetMimeType(&summary->mime_type);
summary->was_cached = request->was_cached();
- // We want to rely on the mime_type to determine the resource type since we
- // dont want types such as PREFETCH, SUB_RESOURCE, etc.
- summary->resource_type =
- ResourcePrefetchPredictor::GetResourceTypeFromMimeType(
- summary->mime_type,
- summary->resource_type);
+ // Use the mime_type to determine the resource type for subresources since
+ // types such as PREFETCH, SUB_RESOURCE, etc are not useful.
+ if (summary->resource_type != ResourceType::MAIN_FRAME) {
+ summary->resource_type =
+ ResourcePrefetchPredictor::GetResourceTypeFromMimeType(
+ summary->mime_type,
+ summary->resource_type);
+ }
return true;
}
@@ -55,7 +57,7 @@ namespace chrome_browser_net {
ResourcePrefetchPredictorObserver::ResourcePrefetchPredictorObserver(
ResourcePrefetchPredictor* predictor)
- : predictor_(predictor->AsWeakPtr()) {
+ : predictor_(predictor->AsWeakPtr()) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698