Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: content/browser/loader/resource_scheduler.h

Issue 692723002: Add histograms to gather ResourceScheduler information. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second round of comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); 144 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id);
145 145
146 // Client functions: 146 // Client functions:
147 147
148 // Called to check if all user observable tabs have completed loading. 148 // Called to check if all user observable tabs have completed loading.
149 bool active_clients_loaded() const { return active_clients_loading_ == 0; } 149 bool active_clients_loaded() const { return active_clients_loading_ == 0; }
150 150
151 bool IsClientVisibleForTesting(int child_id, int route_id); 151 bool IsClientVisibleForTesting(int child_id, int route_id);
152 152
153 private: 153 private:
154 enum ClientState {
155 // Observable client.
156 ACTIVE,
157 // Non-observable client.
158 BACKGROUND,
159 // No client found.
160 UNKNOWN,
161 };
162
154 class RequestQueue; 163 class RequestQueue;
155 class ScheduledResourceRequest; 164 class ScheduledResourceRequest;
156 struct RequestPriorityParams; 165 struct RequestPriorityParams;
157 struct ScheduledResourceSorter { 166 struct ScheduledResourceSorter {
158 bool operator()(const ScheduledResourceRequest* a, 167 bool operator()(const ScheduledResourceRequest* a,
159 const ScheduledResourceRequest* b) const; 168 const ScheduledResourceRequest* b) const;
160 }; 169 };
161 class Client; 170 class Client;
162 171
163 typedef int64 ClientId; 172 typedef int64 ClientId;
(...skipping 17 matching lines...) Expand all
181 190
182 // Called when a Client becomes coalesced. 191 // Called when a Client becomes coalesced.
183 void IncrementCoalescedClients(); 192 void IncrementCoalescedClients();
184 // Called when a client stops being coalesced. 193 // Called when a client stops being coalesced.
185 void DecrementCoalescedClients(); 194 void DecrementCoalescedClients();
186 195
187 void LoadCoalescedRequests(); 196 void LoadCoalescedRequests();
188 197
189 size_t CountCoalescedClients() const; 198 size_t CountCoalescedClients() const;
190 199
200 // Returns UNKNOWN if the corresponding client is not found, else returns
201 // whether the client is ACTIVE (user-observable) or BACKGROUND.
202 ClientState GetClientState(ClientId client_id) const;
203
191 // Update the queue position for |request|, possibly causing it to start 204 // Update the queue position for |request|, possibly causing it to start
192 // loading. 205 // loading.
193 // 206 //
194 // Queues are maintained for each priority level. When |request| is 207 // Queues are maintained for each priority level. When |request| is
195 // reprioritized, it will move to the end of the queue for that priority 208 // reprioritized, it will move to the end of the queue for that priority
196 // level. 209 // level.
197 void ReprioritizeRequest(ScheduledResourceRequest* request, 210 void ReprioritizeRequest(ScheduledResourceRequest* request,
198 net::RequestPriority new_priority, 211 net::RequestPriority new_priority,
199 int intra_priority_value); 212 int intra_priority_value);
200 213
201 // Returns the client ID for the given |child_id| and |route_id| combo. 214 // Returns the client ID for the given |child_id| and |route_id| combo.
202 ClientId MakeClientId(int child_id, int route_id); 215 ClientId MakeClientId(int child_id, int route_id);
203 216
204 // Returns the client for the given |child_id| and |route_id| combo. 217 // Returns the client for the given |child_id| and |route_id| combo.
205 Client* GetClient(int child_id, int route_id); 218 Client* GetClient(int child_id, int route_id);
206 219
207 bool should_coalesce_; 220 bool should_coalesce_;
208 bool should_throttle_; 221 bool should_throttle_;
209 ClientMap client_map_; 222 ClientMap client_map_;
210 size_t active_clients_loading_; 223 size_t active_clients_loading_;
211 size_t coalesced_clients_; 224 size_t coalesced_clients_;
212 // This is a repeating timer to initiate requests on COALESCED Clients. 225 // This is a repeating timer to initiate requests on COALESCED Clients.
213 scoped_ptr<base::Timer> coalescing_timer_; 226 scoped_ptr<base::Timer> coalescing_timer_;
214 RequestSet unowned_requests_; 227 RequestSet unowned_requests_;
215 }; 228 };
216 229
217 } // namespace content 230 } // namespace content
218 231
219 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ 232 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/resource_scheduler.cc » ('j') | content/browser/loader/resource_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698