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 <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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 998 Client* client = client_it->second; | 998 Client* client = client_it->second; |
| 999 client->OnReceivedSpdyProxiedHttpResponse(); | 999 client->OnReceivedSpdyProxiedHttpResponse(); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 bool ResourceScheduler::IsClientVisibleForTesting(int child_id, int route_id) { | 1002 bool ResourceScheduler::IsClientVisibleForTesting(int child_id, int route_id) { |
| 1003 Client* client = GetClient(child_id, route_id); | 1003 Client* client = GetClient(child_id, route_id); |
| 1004 DCHECK(client); | 1004 DCHECK(client); |
| 1005 return client->is_visible(); | 1005 return client->is_visible(); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 bool ResourceScheduler::HasLoadingClients() const { | |
| 1009 for (auto& client : client_map_) { | |
|
mmenke
2015/05/21 15:53:25
nit: const auto& client
Andre
2015/05/21 22:05:39
Done.
| |
| 1010 if (!client.second->is_loaded()) | |
| 1011 return true; | |
| 1012 } | |
| 1013 return false; | |
| 1014 } | |
| 1015 | |
| 1008 ResourceScheduler::Client* ResourceScheduler::GetClient(int child_id, | 1016 ResourceScheduler::Client* ResourceScheduler::GetClient(int child_id, |
| 1009 int route_id) { | 1017 int route_id) { |
| 1010 ClientId client_id = MakeClientId(child_id, route_id); | 1018 ClientId client_id = MakeClientId(child_id, route_id); |
| 1011 ClientMap::iterator client_it = client_map_.find(client_id); | 1019 ClientMap::iterator client_it = client_map_.find(client_id); |
| 1012 if (client_it == client_map_.end()) { | 1020 if (client_it == client_map_.end()) { |
| 1013 return NULL; | 1021 return NULL; |
| 1014 } | 1022 } |
| 1015 return client_it->second; | 1023 return client_it->second; |
| 1016 } | 1024 } |
| 1017 | 1025 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1140 client->ReprioritizeRequest( | 1148 client->ReprioritizeRequest( |
| 1141 request, old_priority_params, new_priority_params); | 1149 request, old_priority_params, new_priority_params); |
| 1142 } | 1150 } |
| 1143 | 1151 |
| 1144 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 1152 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 1145 int child_id, int route_id) { | 1153 int child_id, int route_id) { |
| 1146 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 1154 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 1147 } | 1155 } |
| 1148 | 1156 |
| 1149 } // namespace content | 1157 } // namespace content |
| OLD | NEW |