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

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: 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 2b874332bc58508c60d21a306186a16b792aed2c..12f4f4e20fbbdaa39d349e81c67fd8e8d3474d99 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.
typedef base::Callback<void(const SavePageRequest& request)>
RequestPickedCallback;
- typedef base::Callback<void()> RequestQueueEmptyCallback;
+ typedef base::Callback<void(bool)> RequestQueueEmptyCallback;
RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy,
std::unique_ptr<OfflinerFactory> factory,
@@ -99,7 +99,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) {
@@ -152,6 +153,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);
@@ -168,11 +175,16 @@ class RequestCoordinator : public KeyedService, public RequestNotifier {
const RequestQueue::UpdateMultipleRequestResults& results,
const std::vector<SavePageRequest>& requests);
+
fgorski 2016/08/24 16:07:04 nit: empty line
Pete Williamson 2016/08/25 00:00:58 Done.
+ // 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 RequestQueueEmpty(bool non_user_requested_tasks_remaining);
void SendRequestToOffliner(const SavePageRequest& request);

Powered by Google App Engine
This is Rietveld 408576698