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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 181 |
| 182 // Called when a Client becomes coalesced. | 182 // Called when a Client becomes coalesced. |
| 183 void IncrementCoalescedClients(); | 183 void IncrementCoalescedClients(); |
| 184 // Called when a client stops being coalesced. | 184 // Called when a client stops being coalesced. |
| 185 void DecrementCoalescedClients(); | 185 void DecrementCoalescedClients(); |
| 186 | 186 |
| 187 void LoadCoalescedRequests(); | 187 void LoadCoalescedRequests(); |
| 188 | 188 |
| 189 size_t CountCoalescedClients() const; | 189 size_t CountCoalescedClients() const; |
| 190 | 190 |
| 191 // Returns true iff the client would have the ActiveLoading throttle state | |
| 192 // while it was loading. | |
| 193 bool IsClientActive(ClientId client_id); | |
|
mmenke
2014/10/30 15:14:19
const
| |
| 194 | |
| 191 // Update the queue position for |request|, possibly causing it to start | 195 // Update the queue position for |request|, possibly causing it to start |
| 192 // loading. | 196 // loading. |
| 193 // | 197 // |
| 194 // Queues are maintained for each priority level. When |request| is | 198 // Queues are maintained for each priority level. When |request| is |
| 195 // reprioritized, it will move to the end of the queue for that priority | 199 // reprioritized, it will move to the end of the queue for that priority |
| 196 // level. | 200 // level. |
| 197 void ReprioritizeRequest(ScheduledResourceRequest* request, | 201 void ReprioritizeRequest(ScheduledResourceRequest* request, |
| 198 net::RequestPriority new_priority, | 202 net::RequestPriority new_priority, |
| 199 int intra_priority_value); | 203 int intra_priority_value); |
| 200 | 204 |
| 201 // Returns the client ID for the given |child_id| and |route_id| combo. | 205 // Returns the client ID for the given |child_id| and |route_id| combo. |
| 202 ClientId MakeClientId(int child_id, int route_id); | 206 ClientId MakeClientId(int child_id, int route_id); |
| 203 | 207 |
| 204 // Returns the client for the given |child_id| and |route_id| combo. | 208 // Returns the client for the given |child_id| and |route_id| combo. |
| 205 Client* GetClient(int child_id, int route_id); | 209 Client* GetClient(int child_id, int route_id); |
| 206 | 210 |
| 207 bool should_coalesce_; | 211 bool should_coalesce_; |
| 208 bool should_throttle_; | 212 bool should_throttle_; |
| 209 ClientMap client_map_; | 213 ClientMap client_map_; |
| 210 size_t active_clients_loading_; | 214 size_t active_clients_loading_; |
| 211 size_t coalesced_clients_; | 215 size_t coalesced_clients_; |
| 212 // This is a repeating timer to initiate requests on COALESCED Clients. | 216 // This is a repeating timer to initiate requests on COALESCED Clients. |
| 213 scoped_ptr<base::Timer> coalescing_timer_; | 217 scoped_ptr<base::Timer> coalescing_timer_; |
| 214 RequestSet unowned_requests_; | 218 RequestSet unowned_requests_; |
| 215 }; | 219 }; |
| 216 | 220 |
| 217 } // namespace content | 221 } // namespace content |
| 218 | 222 |
| 219 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 223 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| OLD | NEW |