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

Side by Side Diff: chrome/browser/predictors/resource_prefetcher.cc

Issue 2692093006: predictors: Downgrade net priority of prefetch requests. (Closed)
Patch Set: Change priority to IDLE. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/predictors/resource_prefetcher.h" 5 #include "chrome/browser/predictors/resource_prefetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 internal::kResourcePrefetchPredictorPrefetchedSizeHistogram, 133 internal::kResourcePrefetchPredictorPrefetchedSizeHistogram,
134 prefetched_bytes_ / 1024); 134 prefetched_bytes_ / 1024);
135 135
136 state_ = FINISHED; 136 state_ = FINISHED;
137 delegate_->ResourcePrefetcherFinished(this, std::move(stats_)); 137 delegate_->ResourcePrefetcherFinished(this, std::move(stats_));
138 } 138 }
139 } 139 }
140 140
141 void ResourcePrefetcher::SendRequest(const GURL& url) { 141 void ResourcePrefetcher::SendRequest(const GURL& url) {
142 std::unique_ptr<net::URLRequest> url_request = 142 std::unique_ptr<net::URLRequest> url_request =
143 delegate_->GetURLRequestContext()->CreateRequest(url, net::LOW, this); 143 delegate_->GetURLRequestContext()->CreateRequest(url, net::IDLE, this);
144 host_inflight_counts_[url.host()] += 1; 144 host_inflight_counts_[url.host()] += 1;
145 145
146 url_request->set_method("GET"); 146 url_request->set_method("GET");
147 url_request->set_first_party_for_cookies(main_frame_url_); 147 url_request->set_first_party_for_cookies(main_frame_url_);
148 url_request->set_initiator(url::Origin(main_frame_url_)); 148 url_request->set_initiator(url::Origin(main_frame_url_));
149 url_request->SetReferrer(main_frame_url_.spec()); 149 url_request->SetReferrer(main_frame_url_.spec());
150 url_request->SetLoadFlags(url_request->load_flags() | net::LOAD_PREFETCH); 150 url_request->SetLoadFlags(url_request->load_flags() | net::LOAD_PREFETCH);
151 StartURLRequest(url_request.get()); 151 StartURLRequest(url_request.get());
152 inflight_requests_.insert( 152 inflight_requests_.insert(
153 std::make_pair(url_request.get(), std::move(url_request))); 153 std::make_pair(url_request.get(), std::move(url_request)));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (bytes_read <= 0) { 249 if (bytes_read <= 0) {
250 FinishRequest(request); 250 FinishRequest(request);
251 return; 251 return;
252 } 252 }
253 253
254 if (bytes_read > 0) 254 if (bytes_read > 0)
255 ReadFullResponse(request); 255 ReadFullResponse(request);
256 } 256 }
257 257
258 } // namespace predictors 258 } // namespace predictors
OLDNEW
« 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