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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 }; | 169 }; |
170 class Client; | 170 class Client; |
171 | 171 |
172 typedef int64 ClientId; | 172 typedef int64 ClientId; |
173 typedef std::map<ClientId, Client*> ClientMap; | 173 typedef std::map<ClientId, Client*> ClientMap; |
174 typedef std::set<ScheduledResourceRequest*> RequestSet; | 174 typedef std::set<ScheduledResourceRequest*> RequestSet; |
175 | 175 |
176 // Called when a ScheduledResourceRequest is destroyed. | 176 // Called when a ScheduledResourceRequest is destroyed. |
177 void RemoveRequest(ScheduledResourceRequest* request); | 177 void RemoveRequest(ScheduledResourceRequest* request); |
178 | 178 |
179 // Get the total number of Clients the ResourceScheduler knows about. | |
180 size_t GetNumClients() const; | |
mmenke
2015/01/06 19:30:03
optional: Not sure having a method to do this get
aiolos (Not reviewing)
2015/01/07 22:28:16
Done.
| |
181 | |
179 // These calls may update the ThrottleState of all clients, and have the | 182 // These calls may update the ThrottleState of all clients, and have the |
180 // potential to be re-entrant. | 183 // potential to be re-entrant. |
181 // Called when a Client newly becomes active loading. | 184 // Called when a Client newly becomes active loading. |
182 void IncrementActiveClientsLoading(); | 185 void IncrementActiveClientsLoading(); |
183 // Called when an active and loading Client either completes loading or | 186 // Called when an active and loading Client either completes loading or |
184 // becomes inactive. | 187 // becomes inactive. |
185 void DecrementActiveClientsLoading(); | 188 void DecrementActiveClientsLoading(); |
186 | 189 |
187 void OnLoadingActiveClientsStateChangedForAllClients(); | 190 void OnLoadingActiveClientsStateChangedForAllClients(); |
188 | 191 |
(...skipping 24 matching lines...) Expand all Loading... | |
213 | 216 |
214 // Returns the client ID for the given |child_id| and |route_id| combo. | 217 // Returns the client ID for the given |child_id| and |route_id| combo. |
215 ClientId MakeClientId(int child_id, int route_id); | 218 ClientId MakeClientId(int child_id, int route_id); |
216 | 219 |
217 // Returns the client for the given |child_id| and |route_id| combo. | 220 // Returns the client for the given |child_id| and |route_id| combo. |
218 Client* GetClient(int child_id, int route_id); | 221 Client* GetClient(int child_id, int route_id); |
219 | 222 |
220 bool should_coalesce_; | 223 bool should_coalesce_; |
221 bool should_throttle_; | 224 bool should_throttle_; |
222 ClientMap client_map_; | 225 ClientMap client_map_; |
226 size_t num_clients_; | |
mmenke
2015/01/06 19:30:03
Not used any more.
aiolos (Not reviewing)
2015/01/07 22:28:16
Done.
| |
223 size_t active_clients_loading_; | 227 size_t active_clients_loading_; |
224 size_t coalesced_clients_; | 228 size_t coalesced_clients_; |
225 // This is a repeating timer to initiate requests on COALESCED Clients. | 229 // This is a repeating timer to initiate requests on COALESCED Clients. |
226 scoped_ptr<base::Timer> coalescing_timer_; | 230 scoped_ptr<base::Timer> coalescing_timer_; |
227 RequestSet unowned_requests_; | 231 RequestSet unowned_requests_; |
228 }; | 232 }; |
229 | 233 |
230 } // namespace content | 234 } // namespace content |
231 | 235 |
232 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 236 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
OLD | NEW |