| 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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 RequestPriorityParams(url_request->priority(), 0))); | 764 RequestPriorityParams(url_request->priority(), 0))); |
| 765 | 765 |
| 766 ClientMap::iterator it = client_map_.find(client_id); | 766 ClientMap::iterator it = client_map_.find(client_id); |
| 767 if (it == client_map_.end()) { | 767 if (it == client_map_.end()) { |
| 768 // There are several ways this could happen: | 768 // There are several ways this could happen: |
| 769 // 1. <a ping> requests don't have a route_id. | 769 // 1. <a ping> requests don't have a route_id. |
| 770 // 2. Most unittests don't send the IPCs needed to register Clients. | 770 // 2. Most unittests don't send the IPCs needed to register Clients. |
| 771 // 3. The tab is closed while a RequestResource IPC is in flight. | 771 // 3. The tab is closed while a RequestResource IPC is in flight. |
| 772 unowned_requests_.insert(request.get()); | 772 unowned_requests_.insert(request.get()); |
| 773 request->Start(); | 773 request->Start(); |
| 774 return request.PassAs<ResourceThrottle>(); | 774 return request.Pass(); |
| 775 } | 775 } |
| 776 | 776 |
| 777 Client* client = it->second; | 777 Client* client = it->second; |
| 778 client->ScheduleRequest(url_request, request.get()); | 778 client->ScheduleRequest(url_request, request.get()); |
| 779 return request.PassAs<ResourceThrottle>(); | 779 return request.Pass(); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void ResourceScheduler::RemoveRequest(ScheduledResourceRequest* request) { | 782 void ResourceScheduler::RemoveRequest(ScheduledResourceRequest* request) { |
| 783 DCHECK(CalledOnValidThread()); | 783 DCHECK(CalledOnValidThread()); |
| 784 if (ContainsKey(unowned_requests_, request)) { | 784 if (ContainsKey(unowned_requests_, request)) { |
| 785 unowned_requests_.erase(request); | 785 unowned_requests_.erase(request); |
| 786 return; | 786 return; |
| 787 } | 787 } |
| 788 | 788 |
| 789 ClientMap::iterator client_it = client_map_.find(request->client_id()); | 789 ClientMap::iterator client_it = client_map_.find(request->client_id()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 client->ReprioritizeRequest( | 1034 client->ReprioritizeRequest( |
| 1035 request, old_priority_params, new_priority_params); | 1035 request, old_priority_params, new_priority_params); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 1038 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 1039 int child_id, int route_id) { | 1039 int child_id, int route_id) { |
| 1040 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 1040 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 } // namespace content | 1043 } // namespace content |
| OLD | NEW |