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

Unified Diff: components/offline_pages/background/request_coordinator.h

Issue 2269173003: Adjust scheduling for non-user requested items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests written and working. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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 885970c48613a59961b4d31060ae96b0b408a254..545e2675d83aa9884e94bc1630cde2afe28be0ce 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -51,7 +51,7 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
// Callback to report when the processing of a triggered task is complete.
dougarnett 2016/08/29 15:47:22 comment doesn't seem to match
Pete Williamson 2016/09/01 00:10:31 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,
@@ -105,7 +105,8 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
// 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) {
@@ -132,6 +133,8 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
// 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_;
@@ -158,6 +161,12 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
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);
@@ -179,11 +188,15 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
const RequestQueue::UpdateMultipleRequestResults& results,
const std::vector<SavePageRequest>& requests);
+ // 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);
dougarnett 2016/08/29 15:47:22 I wonder if this should be something like least_re
Pete Williamson 2016/09/01 00:10:31 While it would be useful to have something like Tr
dougarnett 2016/09/01 18:24:13 Ok, please comment the point of the arg so a bit e
Pete Williamson 2016/09/01 21:56:08 Done.
// Cancels an in progress pre-rendering, and updates state appropriately.
void StopPrerendering();

Powered by Google App Engine
This is Rietveld 408576698