| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Queues are maintained for each priority level. When |request| is | 105 // Queues are maintained for each priority level. When |request| is |
| 106 // reprioritized, it will move to the end of the queue for that priority | 106 // reprioritized, it will move to the end of the queue for that priority |
| 107 // level. | 107 // level. |
| 108 void ReprioritizeRequest(ScheduledResourceRequest* request, | 108 void ReprioritizeRequest(ScheduledResourceRequest* request, |
| 109 net::RequestPriority new_priority); | 109 net::RequestPriority new_priority); |
| 110 | 110 |
| 111 // Attempts to load any pending requests in |client|, based on the | 111 // Attempts to load any pending requests in |client|, based on the |
| 112 // results of ShouldStartRequest(). | 112 // results of ShouldStartRequest(). |
| 113 void LoadAnyStartablePendingRequests(Client* client); | 113 void LoadAnyStartablePendingRequests(Client* client); |
| 114 | 114 |
| 115 // Returns the number of requests with priority < LOW that are currently in | 115 // Returns the number of requests with same host that are currently in |
| 116 // flight. | 116 // flight. |
| 117 void GetNumDelayableRequestsInFlight( | 117 size_t GetNumSameHostRequestsInFlight( |
| 118 Client* client, | 118 Client* client, |
| 119 const net::HostPortPair& active_request_host, | 119 const net::HostPortPair& active_request_host) const; |
| 120 size_t* total_delayable, | |
| 121 size_t* total_for_active_host) const; | |
| 122 | 120 |
| 123 enum ShouldStartReqResult { | 121 enum ShouldStartReqResult { |
| 124 DO_NOT_START_REQUEST_AND_STOP_SEARCHING = -2, | 122 DO_NOT_START_REQUEST_AND_STOP_SEARCHING = -2, |
| 125 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING = -1, | 123 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING = -1, |
| 126 START_REQUEST = 1, | 124 START_REQUEST = 1, |
| 127 }; | 125 }; |
| 128 | 126 |
| 129 // Returns true if the request should start. This is the core scheduling | 127 // Returns true if the request should start. This is the core scheduling |
| 130 // algorithm. | 128 // algorithm. |
| 131 ShouldStartReqResult ShouldStartRequest(ScheduledResourceRequest* request, | 129 ShouldStartReqResult ShouldStartRequest(ScheduledResourceRequest* request, |
| 132 Client* client) const; | 130 Client* client) const; |
| 133 | 131 |
| 134 // Returns the client ID for the given |child_id| and |route_id| combo. | 132 // Returns the client ID for the given |child_id| and |route_id| combo. |
| 135 ClientId MakeClientId(int child_id, int route_id); | 133 ClientId MakeClientId(int child_id, int route_id); |
| 136 | 134 |
| 137 ClientMap client_map_; | 135 ClientMap client_map_; |
| 138 RequestSet unowned_requests_; | 136 RequestSet unowned_requests_; |
| 139 }; | 137 }; |
| 140 | 138 |
| 141 } // namespace content | 139 } // namespace content |
| 142 | 140 |
| 143 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 141 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| OLD | NEW |