Skip to content

Commit

Permalink
Speculative resource prefetching - Not modify resource_type for MAIN_…
Browse files Browse the repository at this point in the history
…FRAME requests.

We override resource_types for subresources based on mime_types to not have to
deal with types such as PREFETCH, SUBRESOURCE, etc. But we should not do this
for main frame requests which we want to treat separately.

BUG=140838


Review URL: https://chromiumcodereview.appspot.com/10829195

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150221 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
shishir@chromium.org committed Aug 7, 2012
1 parent 97ae5bd commit 3544091
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions chrome/browser/net/resource_prefetch_predictor_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -55,7 +57,7 @@ namespace chrome_browser_net {

ResourcePrefetchPredictorObserver::ResourcePrefetchPredictorObserver(
ResourcePrefetchPredictor* predictor)
: predictor_(predictor->AsWeakPtr()) {
: predictor_(predictor->AsWeakPtr()) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}

Expand Down

0 comments on commit 3544091

Please sign in to comment.