| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // Signals from the IO thread | 81 // Signals from the IO thread |
| 82 | 82 |
| 83 // Called when we received a response to a http request that was served | 83 // Called when we received a response to a http request that was served |
| 84 // from a proxy using SPDY. | 84 // from a proxy using SPDY. |
| 85 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); | 85 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 class RequestQueue; | 88 class RequestQueue; |
| 89 class ScheduledResourceRequest; | 89 class ScheduledResourceRequest; |
| 90 struct RequestPriorityParams; |
| 91 struct ScheduledResourceSorter { |
| 92 bool operator()(const ScheduledResourceRequest* a, |
| 93 const ScheduledResourceRequest* b) const; |
| 94 }; |
| 90 struct Client; | 95 struct Client; |
| 91 | 96 |
| 92 typedef int64 ClientId; | 97 typedef int64 ClientId; |
| 93 typedef std::map<ClientId, Client*> ClientMap; | 98 typedef std::map<ClientId, Client*> ClientMap; |
| 94 typedef std::set<ScheduledResourceRequest*> RequestSet; | 99 typedef std::set<ScheduledResourceRequest*> RequestSet; |
| 95 | 100 |
| 96 // Called when a ScheduledResourceRequest is destroyed. | 101 // Called when a ScheduledResourceRequest is destroyed. |
| 97 void RemoveRequest(ScheduledResourceRequest* request); | 102 void RemoveRequest(ScheduledResourceRequest* request); |
| 98 | 103 |
| 99 // Unthrottles the |request| and adds it to |client|. | 104 // Unthrottles the |request| and adds it to |client|. |
| 100 void StartRequest(ScheduledResourceRequest* request, Client* client); | 105 void StartRequest(ScheduledResourceRequest* request, Client* client); |
| 101 | 106 |
| 102 // Update the queue position for |request|, possibly causing it to start | 107 // Update the queue position for |request|, possibly causing it to start |
| 103 // loading. | 108 // loading. |
| 104 // | 109 // |
| 105 // Queues are maintained for each priority level. When |request| is | 110 // Queues are maintained for each priority level. When |request| is |
| 106 // reprioritized, it will move to the end of the queue for that priority | 111 // reprioritized, it will move to the end of the queue for that priority |
| 107 // level. | 112 // level. |
| 108 void ReprioritizeRequest(ScheduledResourceRequest* request, | 113 void ReprioritizeRequest(ScheduledResourceRequest* request, |
| 109 net::RequestPriority new_priority); | 114 net::RequestPriority new_priority, |
| 115 int intra_priority_value); |
| 110 | 116 |
| 111 // Attempts to load any pending requests in |client|, based on the | 117 // Attempts to load any pending requests in |client|, based on the |
| 112 // results of ShouldStartRequest(). | 118 // results of ShouldStartRequest(). |
| 113 void LoadAnyStartablePendingRequests(Client* client); | 119 void LoadAnyStartablePendingRequests(Client* client); |
| 114 | 120 |
| 115 // Returns the number of requests with priority < LOW that are currently in | 121 // Returns the number of requests with priority < LOW that are currently in |
| 116 // flight. | 122 // flight. |
| 117 void GetNumDelayableRequestsInFlight( | 123 void GetNumDelayableRequestsInFlight( |
| 118 Client* client, | 124 Client* client, |
| 119 const net::HostPortPair& active_request_host, | 125 const net::HostPortPair& active_request_host, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 134 // Returns the client ID for the given |child_id| and |route_id| combo. | 140 // Returns the client ID for the given |child_id| and |route_id| combo. |
| 135 ClientId MakeClientId(int child_id, int route_id); | 141 ClientId MakeClientId(int child_id, int route_id); |
| 136 | 142 |
| 137 ClientMap client_map_; | 143 ClientMap client_map_; |
| 138 RequestSet unowned_requests_; | 144 RequestSet unowned_requests_; |
| 139 }; | 145 }; |
| 140 | 146 |
| 141 } // namespace content | 147 } // namespace content |
| 142 | 148 |
| 143 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 149 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| OLD | NEW |