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 <set> | 5 #include <set> |
6 | 6 |
7 #include "content/browser/loader/resource_scheduler.h" | 7 #include "content/browser/loader/resource_scheduler.h" |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "content/common/resource_messages.h" | 10 #include "content/common/resource_messages.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 pending_requests_.Insert(request); | 302 pending_requests_.Insert(request); |
303 | 303 |
304 if (new_priority_params.priority > old_priority_params.priority) { | 304 if (new_priority_params.priority > old_priority_params.priority) { |
305 // Check if this request is now able to load at its new priority. | 305 // Check if this request is now able to load at its new priority. |
306 LoadAnyStartablePendingRequests(); | 306 LoadAnyStartablePendingRequests(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 private: | 310 private: |
311 enum ShouldStartReqResult { | 311 enum ShouldStartReqResult { |
312 DO_NOT_START_REQUEST_AND_STOP_SEARCHING = -2, | 312 DO_NOT_START_REQUEST_AND_STOP_SEARCHING, |
313 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING = -1, | 313 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING, |
314 START_REQUEST = 1, | 314 START_REQUEST, |
315 }; | 315 }; |
316 | 316 |
317 void InsertInFlightRequest(ScheduledResourceRequest* request) { | 317 void InsertInFlightRequest(ScheduledResourceRequest* request) { |
318 in_flight_requests_.insert(request); | 318 in_flight_requests_.insert(request); |
319 if (IsDelayableRequest(request)) | 319 if (IsDelayableRequest(request)) |
320 SetRequestDelayable(request, true); | 320 SetRequestDelayable(request, true); |
321 } | 321 } |
322 | 322 |
323 void EraseInFlightRequest(ScheduledResourceRequest* request) { | 323 void EraseInFlightRequest(ScheduledResourceRequest* request) { |
324 size_t erased = in_flight_requests_.erase(request); | 324 size_t erased = in_flight_requests_.erase(request); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 client->ReprioritizeRequest( | 648 client->ReprioritizeRequest( |
649 request, old_priority_params, new_priority_params); | 649 request, old_priority_params, new_priority_params); |
650 } | 650 } |
651 | 651 |
652 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 652 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
653 int child_id, int route_id) { | 653 int child_id, int route_id) { |
654 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 654 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
655 } | 655 } |
656 | 656 |
657 } // namespace content | 657 } // namespace content |
OLD | NEW |