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

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

Issue 1706903003: Delay resource scheduling decisions until network access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests Created 4 years, 10 months 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 struct ScheduledResourceSorter { 156 struct ScheduledResourceSorter {
157 bool operator()(const ScheduledResourceRequest* a, 157 bool operator()(const ScheduledResourceRequest* a,
158 const ScheduledResourceRequest* b) const; 158 const ScheduledResourceRequest* b) const;
159 }; 159 };
160 class Client; 160 class Client;
161 161
162 typedef int64_t ClientId; 162 typedef int64_t ClientId;
163 typedef std::map<ClientId, Client*> ClientMap; 163 typedef std::map<ClientId, Client*> ClientMap;
164 typedef std::set<ScheduledResourceRequest*> RequestSet; 164 typedef std::set<ScheduledResourceRequest*> RequestSet;
165 165
166 // Called when a ScheduledResourceRequest is about to be sent over the network
167 // to determine if it should be delayed or sent.
168 bool ShouldSendRequest(ScheduledResourceRequest* request);
169
166 // Called when a ScheduledResourceRequest is destroyed. 170 // Called when a ScheduledResourceRequest is destroyed.
167 void RemoveRequest(ScheduledResourceRequest* request); 171 void RemoveRequest(ScheduledResourceRequest* request);
168 172
169 // Returns the client ID for the given |child_id| and |route_id| combo. 173 // Returns the client ID for the given |child_id| and |route_id| combo.
170 ClientId MakeClientId(int child_id, int route_id); 174 ClientId MakeClientId(int child_id, int route_id);
171 175
172 // Returns the client for the given |child_id| and |route_id| combo. 176 // Returns the client for the given |child_id| and |route_id| combo.
173 Client* GetClient(int child_id, int route_id); 177 Client* GetClient(int child_id, int route_id);
174 178
175 ClientMap client_map_; 179 ClientMap client_map_;
176 bool limit_outstanding_requests_; 180 bool limit_outstanding_requests_;
177 size_t outstanding_request_limit_; 181 size_t outstanding_request_limit_;
178 net::RequestPriority non_delayable_threshold_; 182 net::RequestPriority non_delayable_threshold_;
179 bool enable_in_flight_non_delayable_threshold_; 183 bool enable_in_flight_non_delayable_threshold_;
180 size_t in_flight_non_delayable_threshold_; 184 size_t in_flight_non_delayable_threshold_;
181 size_t max_num_delayable_while_layout_blocking_; 185 size_t max_num_delayable_while_layout_blocking_;
182 size_t max_num_delayable_requests_; 186 size_t max_num_delayable_requests_;
183 RequestSet unowned_requests_; 187 RequestSet unowned_requests_;
184 188
185 DISALLOW_COPY_AND_ASSIGN(ResourceScheduler); 189 DISALLOW_COPY_AND_ASSIGN(ResourceScheduler);
186 }; 190 };
187 191
188 } // namespace content 192 } // namespace content
189 193
190 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ 194 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698