Chromium Code Reviews| Index: components/offline_pages/background/request_coordinator.h |
| diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h |
| index 881f5648b0df17db3ae8c5ed51040f66170fb005..57240fcb21c44200bea12b400e2da6173e64e7f6 100644 |
| --- a/components/offline_pages/background/request_coordinator.h |
| +++ b/components/offline_pages/background/request_coordinator.h |
| @@ -53,10 +53,10 @@ class RequestCoordinator : public KeyedService, |
| virtual void OnChanged(const SavePageRequest& request) = 0; |
| }; |
| - // Callback to report when the processing of a triggered task is complete. |
| + // Callback to report when no request was available. |
|
dougarnett
2016/09/01 18:24:13
Could copy this comment to above RequestNotPickedC
Pete Williamson
2016/09/01 21:56:08
Done.
|
| typedef base::Callback<void(const SavePageRequest& request)> |
| RequestPickedCallback; |
| - typedef base::Callback<void()> RequestQueueEmptyCallback; |
| + typedef base::Callback<void(bool)> RequestNotPickedCallback; |
| RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy, |
| std::unique_ptr<OfflinerFactory> factory, |
| @@ -110,7 +110,8 @@ class RequestCoordinator : public KeyedService, |
| // is stopped or complete. |
| void StopProcessing(); |
| - const Scheduler::TriggerConditions GetTriggerConditionsForUserRequest(); |
| + const Scheduler::TriggerConditions GetTriggerConditions( |
| + const bool user_requested); |
| // A way for tests to set the callback in use when an operation is over. |
| void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { |
| @@ -137,6 +138,8 @@ class RequestCoordinator : public KeyedService, |
| // Return an unowned pointer to the Scheduler. |
| Scheduler* scheduler() { return scheduler_.get(); } |
| + OfflinerPolicy* policy() { return policy_.get(); } |
| + |
| // Returns the status of the most recent offlining. |
| Offliner::RequestStatus last_offlining_status() { |
| return last_offlining_status_; |
| @@ -163,6 +166,12 @@ class RequestCoordinator : public KeyedService, |
| RequestQueue::GetRequestsResult result, |
| const std::vector<SavePageRequest>& requests); |
| + // Receives the results of a get from the request queue, and turns that into |
| + // SavePageRequest objects for the caller of GetQueuedRequests. |
| + void GetRequestsForSchedulingCallback( |
| + RequestQueue::GetRequestsResult result, |
| + const std::vector<SavePageRequest>& requests); |
| + |
| // Receives the result of add requests to the request queue. |
| void AddRequestResultCallback(RequestQueue::AddRequestResult result, |
| const SavePageRequest& request); |
| @@ -190,11 +199,15 @@ class RequestCoordinator : public KeyedService, |
| // as to other device conditions). |
| void StartProcessingIfConnected(); |
| + // Check the request queue, and schedule a task corresponding |
| + // to the least restrictive type of request in the queue. |
| + void ScheduleAsNeeded(); |
| + |
| // Callback from the request picker when it has chosen our next request. |
| void RequestPicked(const SavePageRequest& request); |
| // Callback from the request picker when no more requests are in the queue. |
| - void RequestQueueEmpty(); |
| + void RequestNotPicked(bool non_user_requested_tasks_remaining); |
| // Cancels an in progress pre-rendering, and updates state appropriately. |
| void StopPrerendering(); |