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

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

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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 #include "content/browser/loader/resource_scheduler.h" 5 #include "content/browser/loader/resource_scheduler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h"
13 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
18 #include "base/supports_user_data.h" 19 #include "base/supports_user_data.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "content/common/resource_messages.h" 21 #include "content/common/resource_messages.h"
21 #include "content/public/browser/resource_controller.h" 22 #include "content/public/browser/resource_controller.h"
22 #include "content/public/browser/resource_request_info.h" 23 #include "content/public/browser/resource_request_info.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool IsQueued(ScheduledResourceRequest* request) const { 161 bool IsQueued(ScheduledResourceRequest* request) const {
161 return ContainsKey(pointers_, request); 162 return ContainsKey(pointers_, request);
162 } 163 }
163 164
164 // Returns true if no requests are queued. 165 // Returns true if no requests are queued.
165 bool IsEmpty() const { return queue_.size() == 0; } 166 bool IsEmpty() const { return queue_.size() == 0; }
166 167
167 private: 168 private:
168 typedef std::map<ScheduledResourceRequest*, NetQueue::iterator> PointerMap; 169 typedef std::map<ScheduledResourceRequest*, NetQueue::iterator> PointerMap;
169 170
170 uint32 MakeFifoOrderingId() { 171 uint32_t MakeFifoOrderingId() {
171 fifo_ordering_ids_ += 1; 172 fifo_ordering_ids_ += 1;
172 return fifo_ordering_ids_; 173 return fifo_ordering_ids_;
173 } 174 }
174 175
175 // Used to create an ordering ID for scheduled resources so that resources 176 // Used to create an ordering ID for scheduled resources so that resources
176 // with same priority/intra_priority stay in fifo order. 177 // with same priority/intra_priority stay in fifo order.
177 uint32 fifo_ordering_ids_; 178 uint32_t fifo_ordering_ids_;
178 179
179 NetQueue queue_; 180 NetQueue queue_;
180 PointerMap pointers_; 181 PointerMap pointers_;
181 }; 182 };
182 183
183 // This is the handle we return to the ResourceDispatcherHostImpl so it can 184 // This is the handle we return to the ResourceDispatcherHostImpl so it can
184 // interact with the request. 185 // interact with the request.
185 class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle { 186 class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
186 public: 187 public:
187 ScheduledResourceRequest(const ClientId& client_id, 188 ScheduledResourceRequest(const ClientId& client_id,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 void set_request_priority_params(const RequestPriorityParams& priority) { 276 void set_request_priority_params(const RequestPriorityParams& priority) {
276 priority_ = priority; 277 priority_ = priority;
277 } 278 }
278 const RequestPriorityParams& get_request_priority_params() const { 279 const RequestPriorityParams& get_request_priority_params() const {
279 return priority_; 280 return priority_;
280 } 281 }
281 const ClientId& client_id() const { return client_id_; } 282 const ClientId& client_id() const { return client_id_; }
282 net::URLRequest* url_request() { return request_; } 283 net::URLRequest* url_request() { return request_; }
283 const net::URLRequest* url_request() const { return request_; } 284 const net::URLRequest* url_request() const { return request_; }
284 bool is_async() const { return is_async_; } 285 bool is_async() const { return is_async_; }
285 uint32 fifo_ordering() const { return fifo_ordering_; } 286 uint32_t fifo_ordering() const { return fifo_ordering_; }
286 void set_fifo_ordering(uint32 fifo_ordering) { 287 void set_fifo_ordering(uint32_t fifo_ordering) {
287 fifo_ordering_ = fifo_ordering; 288 fifo_ordering_ = fifo_ordering;
288 } 289 }
289 RequestAttributes attributes() const { 290 RequestAttributes attributes() const {
290 return attributes_; 291 return attributes_;
291 } 292 }
292 void set_attributes(RequestAttributes attributes) { 293 void set_attributes(RequestAttributes attributes) {
293 attributes_ = attributes; 294 attributes_ = attributes;
294 } 295 }
295 296
296 private: 297 private:
(...skipping 22 matching lines...) Expand all
319 320
320 const ClientId client_id_; 321 const ClientId client_id_;
321 const ResourceScheduler::ClientState client_state_on_creation_; 322 const ResourceScheduler::ClientState client_state_on_creation_;
322 net::URLRequest* request_; 323 net::URLRequest* request_;
323 bool ready_; 324 bool ready_;
324 bool deferred_; 325 bool deferred_;
325 bool is_async_; 326 bool is_async_;
326 RequestAttributes attributes_; 327 RequestAttributes attributes_;
327 ResourceScheduler* scheduler_; 328 ResourceScheduler* scheduler_;
328 RequestPriorityParams priority_; 329 RequestPriorityParams priority_;
329 uint32 fifo_ordering_; 330 uint32_t fifo_ordering_;
330 base::TimeTicks time_deferred_; 331 base::TimeTicks time_deferred_;
331 332
332 base::WeakPtrFactory<ResourceScheduler::ScheduledResourceRequest> 333 base::WeakPtrFactory<ResourceScheduler::ScheduledResourceRequest>
333 weak_ptr_factory_; 334 weak_ptr_factory_;
334 335
335 DISALLOW_COPY_AND_ASSIGN(ScheduledResourceRequest); 336 DISALLOW_COPY_AND_ASSIGN(ScheduledResourceRequest);
336 }; 337 };
337 338
338 const void* const ResourceScheduler::ScheduledResourceRequest::kUserDataKey = 339 const void* const ResourceScheduler::ScheduledResourceRequest::kUserDataKey =
339 &ResourceScheduler::ScheduledResourceRequest::kUserDataKey; 340 &ResourceScheduler::ScheduledResourceRequest::kUserDataKey;
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params, 1367 client->ReprioritizeRequest(scheduled_resource_request, old_priority_params,
1367 new_priority_params); 1368 new_priority_params);
1368 } 1369 }
1369 1370
1370 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( 1371 ResourceScheduler::ClientId ResourceScheduler::MakeClientId(
1371 int child_id, int route_id) { 1372 int child_id, int route_id) {
1372 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; 1373 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id;
1373 } 1374 }
1374 1375
1375 } // namespace content 1376 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_scheduler.h ('k') | content/browser/loader/resource_scheduler_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698