| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 ResourceScheduler::~ResourceScheduler() { | 774 ResourceScheduler::~ResourceScheduler() { |
| 775 DCHECK(unowned_requests_.empty()); | 775 DCHECK(unowned_requests_.empty()); |
| 776 DCHECK(client_map_.empty()); | 776 DCHECK(client_map_.empty()); |
| 777 } | 777 } |
| 778 | 778 |
| 779 scoped_ptr<ResourceThrottle> ResourceScheduler::ScheduleRequest( | 779 scoped_ptr<ResourceThrottle> ResourceScheduler::ScheduleRequest( |
| 780 int child_id, | 780 int child_id, |
| 781 int route_id, | 781 int route_id, |
| 782 bool is_async, | 782 bool is_async, |
| 783 net::URLRequest* url_request) { | 783 net::URLRequest* url_request) { |
| 784 TRACE_EVENT0("toplevel", "ResourceScheduler::ScheduleRequest"); |
| 784 DCHECK(CalledOnValidThread()); | 785 DCHECK(CalledOnValidThread()); |
| 785 ClientId client_id = MakeClientId(child_id, route_id); | 786 ClientId client_id = MakeClientId(child_id, route_id); |
| 786 scoped_ptr<ScheduledResourceRequest> request(new ScheduledResourceRequest( | 787 scoped_ptr<ScheduledResourceRequest> request(new ScheduledResourceRequest( |
| 787 client_id, url_request, this, | 788 client_id, url_request, this, |
| 788 RequestPriorityParams(url_request->priority(), 0), is_async)); | 789 RequestPriorityParams(url_request->priority(), 0), is_async)); |
| 789 | 790 |
| 790 ClientMap::iterator it = client_map_.find(client_id); | 791 ClientMap::iterator it = client_map_.find(client_id); |
| 791 if (it == client_map_.end()) { | 792 if (it == client_map_.end()) { |
| 792 // There are several ways this could happen: | 793 // There are several ways this could happen: |
| 793 // 1. <a ping> requests don't have a route_id. | 794 // 1. <a ping> requests don't have a route_id. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params, | 958 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params, |
| 958 new_priority_params); | 959 new_priority_params); |
| 959 } | 960 } |
| 960 | 961 |
| 961 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 962 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 962 int child_id, int route_id) { | 963 int child_id, int route_id) { |
| 963 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 964 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 964 } | 965 } |
| 965 | 966 |
| 966 } // namespace content | 967 } // namespace content |
| OLD | NEW |