Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 } | 283 } |
| 284 | 284 |
| 285 Client *client = client_it->second; | 285 Client *client = client_it->second; |
| 286 if (!client->pending_requests.IsQueued(request)) { | 286 if (!client->pending_requests.IsQueued(request)) { |
| 287 DCHECK(ContainsKey(client->in_flight_requests, request)); | 287 DCHECK(ContainsKey(client->in_flight_requests, request)); |
| 288 // Request has already started. | 288 // Request has already started. |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 | 291 |
| 292 client->pending_requests.Erase(request); | 292 client->pending_requests.Erase(request); |
| 293 client->pending_requests.Insert(request, request->url_request()->priority()); | 293 client->pending_requests.Insert(request, |
|
akalin
2013/10/30 23:32:16
should this also do InsertAtFront if ignore_limits
akalin
2013/11/01 07:02:47
Matt, any opinion here? Should I add a TODO?
mmenke
2013/11/01 15:48:00
We shouldn't be reprioritizing those requests in t
akalin
2013/11/01 18:50:15
Ah, right. Added a check instead.
| |
| 294 request->url_request()->priority()); | |
| 294 | 295 |
| 295 if (new_priority > old_priority) { | 296 if (new_priority > old_priority) { |
| 296 // Check if this request is now able to load at its new priority. | 297 // Check if this request is now able to load at its new priority. |
| 297 LoadAnyStartablePendingRequests(client); | 298 LoadAnyStartablePendingRequests(client); |
| 298 } | 299 } |
| 299 } | 300 } |
| 300 | 301 |
| 301 void ResourceScheduler::LoadAnyStartablePendingRequests(Client* client) { | 302 void ResourceScheduler::LoadAnyStartablePendingRequests(Client* client) { |
| 302 while (!client->pending_requests.IsEmpty()) { | 303 while (!client->pending_requests.IsEmpty()) { |
| 303 ScheduledResourceRequest* request = client->pending_requests.FirstMax(); | 304 ScheduledResourceRequest* request = client->pending_requests.FirstMax(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 | 386 |
| 386 return true; | 387 return true; |
| 387 } | 388 } |
| 388 | 389 |
| 389 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 390 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 390 int child_id, int route_id) { | 391 int child_id, int route_id) { |
| 391 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 392 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 392 } | 393 } |
| 393 | 394 |
| 394 } // namespace content | 395 } // namespace content |
| OLD | NEW |