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

Side by Side Diff: trunk/src/content/browser/loader/resource_scheduler.cc

Issue 47563006: Revert 232802 "[Net] Assert that URLRequests with LOAD_IGNORE_LI..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/loader/resource_scheduler.h" 5 #include "content/browser/loader/resource_scheduler.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "content/common/resource_messages.h" 8 #include "content/common/resource_messages.h"
9 #include "content/browser/loader/resource_message_delegate.h" 9 #include "content/browser/loader/resource_message_delegate.h"
10 #include "content/public/browser/resource_controller.h" 10 #include "content/public/browser/resource_controller.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 void ResourceScheduler::StartRequest(ScheduledResourceRequest* request, 268 void ResourceScheduler::StartRequest(ScheduledResourceRequest* request,
269 Client* client) { 269 Client* client) {
270 client->in_flight_requests.insert(request); 270 client->in_flight_requests.insert(request);
271 request->Start(); 271 request->Start();
272 } 272 }
273 273
274 void ResourceScheduler::ReprioritizeRequest(ScheduledResourceRequest* request, 274 void ResourceScheduler::ReprioritizeRequest(ScheduledResourceRequest* request,
275 net::RequestPriority new_priority) { 275 net::RequestPriority new_priority) {
276 if (request->url_request()->load_flags() & net::LOAD_IGNORE_LIMITS) {
277 // We should not be re-prioritizing requests with the
278 // IGNORE_LIMITS flag.
279 NOTREACHED();
280 return;
281 }
282 net::RequestPriority old_priority = request->url_request()->priority(); 276 net::RequestPriority old_priority = request->url_request()->priority();
283 DCHECK_NE(new_priority, old_priority); 277 DCHECK_NE(new_priority, old_priority);
284 request->url_request()->SetPriority(new_priority); 278 request->url_request()->SetPriority(new_priority);
285 ClientMap::iterator client_it = client_map_.find(request->client_id()); 279 ClientMap::iterator client_it = client_map_.find(request->client_id());
286 if (client_it == client_map_.end()) { 280 if (client_it == client_map_.end()) {
287 // The client was likely deleted shortly before we received this IPC. 281 // The client was likely deleted shortly before we received this IPC.
288 return; 282 return;
289 } 283 }
290 284
291 Client *client = client_it->second; 285 Client *client = client_it->second;
292 if (!client->pending_requests.IsQueued(request)) { 286 if (!client->pending_requests.IsQueued(request)) {
293 DCHECK(ContainsKey(client->in_flight_requests, request)); 287 DCHECK(ContainsKey(client->in_flight_requests, request));
294 // Request has already started. 288 // Request has already started.
295 return; 289 return;
296 } 290 }
297 291
298 client->pending_requests.Erase(request); 292 client->pending_requests.Erase(request);
299 client->pending_requests.Insert(request, 293 client->pending_requests.Insert(request, request->url_request()->priority());
300 request->url_request()->priority());
301 294
302 if (new_priority > old_priority) { 295 if (new_priority > old_priority) {
303 // Check if this request is now able to load at its new priority. 296 // Check if this request is now able to load at its new priority.
304 LoadAnyStartablePendingRequests(client); 297 LoadAnyStartablePendingRequests(client);
305 } 298 }
306 } 299 }
307 300
308 void ResourceScheduler::LoadAnyStartablePendingRequests(Client* client) { 301 void ResourceScheduler::LoadAnyStartablePendingRequests(Client* client) {
309 while (!client->pending_requests.IsEmpty()) { 302 while (!client->pending_requests.IsEmpty()) {
310 ScheduledResourceRequest* request = client->pending_requests.FirstMax(); 303 ScheduledResourceRequest* request = client->pending_requests.FirstMax();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 385
393 return true; 386 return true;
394 } 387 }
395 388
396 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( 389 ResourceScheduler::ClientId ResourceScheduler::MakeClientId(
397 int child_id, int route_id) { 390 int child_id, int route_id) {
398 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; 391 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id;
399 } 392 }
400 393
401 } // namespace content 394 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/loader/resource_dispatcher_host_impl.cc ('k') | trunk/src/net/ocsp/nss_ocsp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698