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

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

Issue 2552703003: Make reprioritization IPC batch rather than per-request.
Patch Set: Fix some typos. Created 4 years 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // 47 //
48 // Users should call ScheduleRequest() to notify this ResourceScheduler of a new 48 // Users should call ScheduleRequest() to notify this ResourceScheduler of a new
49 // request. The returned ResourceThrottle should be destroyed when the load 49 // request. The returned ResourceThrottle should be destroyed when the load
50 // finishes or is canceled, before the net::URLRequest. 50 // finishes or is canceled, before the net::URLRequest.
51 // 51 //
52 // The scheduler may defer issuing the request via the ResourceThrottle 52 // The scheduler may defer issuing the request via the ResourceThrottle
53 // interface or it may alter the request's priority by calling set_priority() on 53 // interface or it may alter the request's priority by calling set_priority() on
54 // the URLRequest. 54 // the URLRequest.
55 class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { 55 class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe {
56 public: 56 public:
57 struct PriorityChangeRequest {
58 net::URLRequest* request;
59 net::RequestPriority priority;
60 int intra_priority;
61 };
62
57 ResourceScheduler(); 63 ResourceScheduler();
58 ~ResourceScheduler(); 64 ~ResourceScheduler();
59 65
60 // Requests that this ResourceScheduler schedule, and eventually loads, the 66 // Requests that this ResourceScheduler schedule, and eventually loads, the
61 // specified |url_request|. Caller should delete the returned ResourceThrottle 67 // specified |url_request|. Caller should delete the returned ResourceThrottle
62 // when the load completes or is canceled, before |url_request| is deleted. 68 // when the load completes or is canceled, before |url_request| is deleted.
63 std::unique_ptr<ResourceThrottle> ScheduleRequest( 69 std::unique_ptr<ResourceThrottle> ScheduleRequest(
64 int child_id, 70 int child_id,
65 int route_id, 71 int route_id,
66 bool is_async, 72 bool is_async,
(...skipping 29 matching lines...) Expand all
96 102
97 // Returns true if at least one client is currently loading. 103 // Returns true if at least one client is currently loading.
98 bool HasLoadingClients() const; 104 bool HasLoadingClients() const;
99 105
100 // Update the priority for |request|. Modifies request->priority(), and may 106 // Update the priority for |request|. Modifies request->priority(), and may
101 // start the request loading if it wasn't already started. 107 // start the request loading if it wasn't already started.
102 void ReprioritizeRequest(net::URLRequest* request, 108 void ReprioritizeRequest(net::URLRequest* request,
103 net::RequestPriority new_priority, 109 net::RequestPriority new_priority,
104 int intra_priority_value); 110 int intra_priority_value);
105 111
112 // Update the priority for a set of requests. Modifies request->priority()
113 // and may start the request loading if it wasn't already started.
114 void ReprioritizeRequests(
115 const std::vector<PriorityChangeRequest>& change_requests);
116
106 private: 117 private:
107 // Returns the maximum number of delayable requests to all be in-flight at 118 // Returns the maximum number of delayable requests to all be in-flight at
108 // any point in time (across all hosts). 119 // any point in time (across all hosts).
109 size_t max_num_delayable_requests() const { 120 size_t max_num_delayable_requests() const {
110 return max_num_delayable_requests_; 121 return max_num_delayable_requests_;
111 } 122 }
112 123
113 class RequestQueue; 124 class RequestQueue;
114 class ScheduledResourceRequest; 125 class ScheduledResourceRequest;
115 struct RequestPriorityParams; 126 struct RequestPriorityParams;
(...skipping 23 matching lines...) Expand all
139 // True if requests to servers that support priorities (e.g., H2/QUIC) can 150 // True if requests to servers that support priorities (e.g., H2/QUIC) can
140 // be delayed. 151 // be delayed.
141 bool priority_requests_delayable_; 152 bool priority_requests_delayable_;
142 153
143 DISALLOW_COPY_AND_ASSIGN(ResourceScheduler); 154 DISALLOW_COPY_AND_ASSIGN(ResourceScheduler);
144 }; 155 };
145 156
146 } // namespace content 157 } // namespace content
147 158
148 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ 159 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698