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 }; | |
95 struct Client; | 90 struct Client; |
96 | 91 |
97 typedef int64 ClientId; | 92 typedef int64 ClientId; |
98 typedef std::map<ClientId, Client*> ClientMap; | 93 typedef std::map<ClientId, Client*> ClientMap; |
99 typedef std::set<ScheduledResourceRequest*> RequestSet; | 94 typedef std::set<ScheduledResourceRequest*> RequestSet; |
100 | 95 |
101 // Called when a ScheduledResourceRequest is destroyed. | 96 // Called when a ScheduledResourceRequest is destroyed. |
102 void RemoveRequest(ScheduledResourceRequest* request); | 97 void RemoveRequest(ScheduledResourceRequest* request); |
103 | 98 |
104 // Unthrottles the |request| and adds it to |client|. | 99 // Unthrottles the |request| and adds it to |client|. |
105 void StartRequest(ScheduledResourceRequest* request, Client* client); | 100 void StartRequest(ScheduledResourceRequest* request, Client* client); |
106 | 101 |
107 // Update the queue position for |request|, possibly causing it to start | 102 // Update the queue position for |request|, possibly causing it to start |
108 // loading. | 103 // loading. |
109 // | 104 // |
110 // Queues are maintained for each priority level. When |request| is | 105 // Queues are maintained for each priority level. When |request| is |
111 // 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 |
112 // level. | 107 // level. |
113 void ReprioritizeRequest(ScheduledResourceRequest* request, | 108 void ReprioritizeRequest(ScheduledResourceRequest* request, |
114 net::RequestPriority new_priority, | 109 net::RequestPriority new_priority); |
115 int intra_priority_value); | |
116 | 110 |
117 // Attempts to load any pending requests in |client|, based on the | 111 // Attempts to load any pending requests in |client|, based on the |
118 // results of ShouldStartRequest(). | 112 // results of ShouldStartRequest(). |
119 void LoadAnyStartablePendingRequests(Client* client); | 113 void LoadAnyStartablePendingRequests(Client* client); |
120 | 114 |
121 // Returns the number of requests with priority < LOW that are currently in | 115 // Returns the number of requests with priority < LOW that are currently in |
122 // flight. | 116 // flight. |
123 void GetNumDelayableRequestsInFlight( | 117 void GetNumDelayableRequestsInFlight( |
124 Client* client, | 118 Client* client, |
125 const net::HostPortPair& active_request_host, | 119 const net::HostPortPair& active_request_host, |
(...skipping 14 matching lines...) Expand all Loading... |
140 // Returns the client ID for the given |child_id| and |route_id| combo. | 134 // Returns the client ID for the given |child_id| and |route_id| combo. |
141 ClientId MakeClientId(int child_id, int route_id); | 135 ClientId MakeClientId(int child_id, int route_id); |
142 | 136 |
143 ClientMap client_map_; | 137 ClientMap client_map_; |
144 RequestSet unowned_requests_; | 138 RequestSet unowned_requests_; |
145 }; | 139 }; |
146 | 140 |
147 } // namespace content | 141 } // namespace content |
148 | 142 |
149 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 143 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
OLD | NEW |