Chromium Code Reviews| Index: content/browser/loader/resource_scheduler.h | 
| diff --git a/content/browser/loader/resource_scheduler.h b/content/browser/loader/resource_scheduler.h | 
| index 60cf0cd69f8c10360b3c3f43babb2a61744e7443..13864fb4ecaae0e35261c83ab7f55ce13003ca64 100644 | 
| --- a/content/browser/loader/resource_scheduler.h | 
| +++ b/content/browser/loader/resource_scheduler.h | 
| @@ -14,6 +14,7 @@ | 
| #include "base/threading/non_thread_safe.h" | 
| #include "base/timer/timer.h" | 
| #include "content/common/content_export.h" | 
| +#include "content/public/browser/resource_throttle.h" | 
| #include "net/base/priority_queue.h" | 
| #include "net/base/request_priority.h" | 
| @@ -23,7 +24,19 @@ class URLRequest; | 
| } | 
| namespace content { | 
| -class ResourceThrottle; | 
| +// Handle for a scheduled request. This is declared at namespace scope so that | 
| +// it can be pre-declared in other header files. | 
| +class ScheduledResourceRequest : public ResourceThrottle { | 
| + public: | 
| + ScheduledResourceRequest(); | 
| + ~ScheduledResourceRequest() override; | 
| 
 
davidben
2015/08/12 23:58:11
(Hrm, I would have thought this could be inlined.)
 
Adam Rice
2015/08/13 21:21:02
It can, but then the compiler has to generate a co
 
 | 
| + | 
| + virtual void ChangePriority(net::RequestPriority new_priority, | 
| + int intra_priority_value) = 0; | 
| + | 
| + private: | 
| + DISALLOW_COPY_AND_ASSIGN(ScheduledResourceRequest); | 
| +}; | 
| // There is one ResourceScheduler. All renderer-initiated HTTP requests are | 
| // expected to pass through it. | 
| @@ -44,9 +57,9 @@ class ResourceThrottle; | 
| // Each Client may have many Requests in flight. Requests are uniquely | 
| // identified within a Client by its ScheduledResourceRequest. | 
| // | 
| -// Users should call ScheduleRequest() to notify this ResourceScheduler of a | 
| -// new request. The returned ResourceThrottle should be destroyed when the load | 
| -// finishes or is canceled. | 
| +// Users should call ScheduleRequest() to notify this ResourceScheduler of a new | 
| +// request. The returned ScheduledResourceRequest should be destroyed when the | 
| +// load finishes or is canceled. | 
| // | 
| // The scheduler may defer issuing the request via the ResourceThrottle | 
| // interface or it may alter the request's priority by calling set_priority() on | 
| @@ -103,10 +116,13 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| ClientThrottleState GetClientStateForTesting(int child_id, int route_id); | 
| // Requests that this ResourceScheduler schedule, and eventually loads, the | 
| - // specified |url_request|. Caller should delete the returned ResourceThrottle | 
| - // when the load completes or is canceled. | 
| - scoped_ptr<ResourceThrottle> ScheduleRequest( | 
| - int child_id, int route_id, net::URLRequest* url_request); | 
| + // specified |url_request|. Caller should delete the returned | 
| + // ScheduledResourceRequest when the load completes or is canceled. | 
| + scoped_ptr<ScheduledResourceRequest> ScheduleRequest( | 
| + int child_id, | 
| + int route_id, | 
| + bool is_async, | 
| + net::URLRequest* url_request); | 
| // Signals from the UI thread, posted as tasks on the IO thread: | 
| @@ -175,20 +191,20 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| }; | 
| class RequestQueue; | 
| - class ScheduledResourceRequest; | 
| + class ScheduledResourceRequestImpl; | 
| struct RequestPriorityParams; | 
| struct ScheduledResourceSorter { | 
| - bool operator()(const ScheduledResourceRequest* a, | 
| - const ScheduledResourceRequest* b) const; | 
| + bool operator()(const ScheduledResourceRequestImpl* a, | 
| + const ScheduledResourceRequestImpl* b) const; | 
| }; | 
| class Client; | 
| typedef int64 ClientId; | 
| typedef std::map<ClientId, Client*> ClientMap; | 
| - typedef std::set<ScheduledResourceRequest*> RequestSet; | 
| + typedef std::set<ScheduledResourceRequestImpl*> RequestSet; | 
| - // Called when a ScheduledResourceRequest is destroyed. | 
| - void RemoveRequest(ScheduledResourceRequest* request); | 
| + // Called when a ScheduledResourceRequestImpl is destroyed. | 
| + void RemoveRequest(ScheduledResourceRequestImpl* request); | 
| // These calls may update the ThrottleState of all clients, and have the | 
| // potential to be re-entrant. | 
| @@ -221,7 +237,7 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { | 
| // Queues are maintained for each priority level. When |request| is | 
| // reprioritized, it will move to the end of the queue for that priority | 
| // level. | 
| - void ReprioritizeRequest(ScheduledResourceRequest* request, | 
| + void ReprioritizeRequest(ScheduledResourceRequestImpl* request, | 
| net::RequestPriority new_priority, | 
| int intra_priority_value); |