OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/offline_pages/core/background/request_queue.h" | 5 #include "components/offline_pages/core/background/request_queue.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 new MarkAttemptCompletedTask(store_.get(), request_id, callback)); | 121 new MarkAttemptCompletedTask(store_.get(), request_id, callback)); |
122 task_queue_.AddTask(std::move(task)); | 122 task_queue_.AddTask(std::move(task)); |
123 } | 123 } |
124 | 124 |
125 void RequestQueue::PickNextRequest( | 125 void RequestQueue::PickNextRequest( |
126 OfflinerPolicy* policy, | 126 OfflinerPolicy* policy, |
127 PickRequestTask::RequestPickedCallback picked_callback, | 127 PickRequestTask::RequestPickedCallback picked_callback, |
128 PickRequestTask::RequestNotPickedCallback not_picked_callback, | 128 PickRequestTask::RequestNotPickedCallback not_picked_callback, |
129 PickRequestTask::RequestCountCallback request_count_callback, | 129 PickRequestTask::RequestCountCallback request_count_callback, |
130 DeviceConditions& conditions, | 130 DeviceConditions& conditions, |
131 std::set<int64_t>& disabled_requests) { | 131 std::set<int64_t>& disabled_requests, |
| 132 std::deque<int64_t>& prioritized_requests) { |
132 // Using the PickerContext, create a picker task. | 133 // Using the PickerContext, create a picker task. |
133 std::unique_ptr<Task> task(new PickRequestTask( | 134 std::unique_ptr<Task> task( |
134 store_.get(), policy, picked_callback, not_picked_callback, | 135 new PickRequestTask(store_.get(), policy, picked_callback, |
135 request_count_callback, conditions, disabled_requests)); | 136 not_picked_callback, request_count_callback, |
| 137 conditions, disabled_requests, prioritized_requests)); |
136 | 138 |
137 // Queue up the picking task, it will call one of the callbacks when it | 139 // Queue up the picking task, it will call one of the callbacks when it |
138 // completes. | 140 // completes. |
139 task_queue_.AddTask(std::move(task)); | 141 task_queue_.AddTask(std::move(task)); |
140 } | 142 } |
141 | 143 |
142 void RequestQueue::ReconcileRequests(const UpdateCallback& callback) { | 144 void RequestQueue::ReconcileRequests(const UpdateCallback& callback) { |
143 std::unique_ptr<Task> task(new ReconcileTask(store_.get(), callback)); | 145 std::unique_ptr<Task> task(new ReconcileTask(store_.get(), callback)); |
144 | 146 |
145 // Queue up the reconcile task. | 147 // Queue up the reconcile task. |
(...skipping 14 matching lines...) Expand all Loading... |
160 weak_ptr_factory_.GetWeakPtr()))); | 162 weak_ptr_factory_.GetWeakPtr()))); |
161 task_queue_.AddTask(std::move(task)); | 163 task_queue_.AddTask(std::move(task)); |
162 } | 164 } |
163 | 165 |
164 void RequestQueue::InitializeStoreDone(bool success) { | 166 void RequestQueue::InitializeStoreDone(bool success) { |
165 // TODO(fgorski): Result can be ignored for now. Report UMA in future. | 167 // TODO(fgorski): Result can be ignored for now. Report UMA in future. |
166 // No need to pass the result up to RequestCoordinator. | 168 // No need to pass the result up to RequestCoordinator. |
167 } | 169 } |
168 | 170 |
169 } // namespace offline_pages | 171 } // namespace offline_pages |
OLD | NEW |