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

Unified Diff: components/offline_pages/background/request_queue.cc

Issue 2543093002: Split the RequestPicker task into two separate tasks. (Closed)
Patch Set: ADD TODO 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_queue.cc
diff --git a/components/offline_pages/background/request_queue.cc b/components/offline_pages/background/request_queue.cc
index aa43ed85d0c32d328d8ef0f41a024ffe26d674ec..5520716348edc99513b37c0d7cc1053f9a84429f 100644
--- a/components/offline_pages/background/request_queue.cc
+++ b/components/offline_pages/background/request_queue.cc
@@ -17,7 +17,6 @@
#include "components/offline_pages/background/mark_attempt_completed_task.h"
#include "components/offline_pages/background/mark_attempt_started_task.h"
#include "components/offline_pages/background/pick_request_task.h"
-#include "components/offline_pages/background/pick_request_task_factory.h"
#include "components/offline_pages/background/remove_requests_task.h"
#include "components/offline_pages/background/request_queue_store.h"
#include "components/offline_pages/background/save_page_request.h"
@@ -123,14 +122,15 @@ void RequestQueue::MarkAttemptCompleted(int64_t request_id,
}
void RequestQueue::PickNextRequest(
+ OfflinerPolicy* policy,
PickRequestTask::RequestPickedCallback picked_callback,
PickRequestTask::RequestNotPickedCallback not_picked_callback,
PickRequestTask::RequestCountCallback request_count_callback,
DeviceConditions& conditions,
std::set<int64_t>& disabled_requests) {
// Using the PickerContext, create a picker task.
- std::unique_ptr<Task> task(picker_factory_->CreatePickerTask(
- store_.get(), picked_callback, not_picked_callback,
+ std::unique_ptr<Task> task(new PickRequestTask(
+ store_.get(), policy, picked_callback, not_picked_callback,
request_count_callback, conditions, disabled_requests));
// Queue up the picking task, it will call one of the callbacks when it
@@ -138,6 +138,14 @@ void RequestQueue::PickNextRequest(
task_queue_.AddTask(std::move(task));
}
+void RequestQueue::CleanupRequestQueue() {
+ // Create a cleanup task.
+ std::unique_ptr<Task> task(cleanup_factory_->CreateCleanupTask(store_.get()));
+
+ // Queue up the cleanup task.
+ task_queue_.AddTask(std::move(task));
+}
+
void RequestQueue::Initialize() {
std::unique_ptr<Task> task(new InitializeStoreTask(
store_.get(), base::Bind(&RequestQueue::InitializeStoreDone,
« no previous file with comments | « components/offline_pages/background/request_queue.h ('k') | components/offline_pages/background/request_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698