#include "components/offline_pages/core/background/request_queue.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "components/offline_pages/core/background/change_requests_state_task.h"
#include "components/offline_pages/core/background/get_requests_task.h"
#include "components/offline_pages/core/background/initialize_store_task.h"
#include "components/offline_pages/core/background/mark_attempt_aborted_task.h"
#include "components/offline_pages/core/background/mark_attempt_completed_task.h"
#include "components/offline_pages/core/background/mark_attempt_deferred_task.h"
#include "components/offline_pages/core/background/mark_attempt_started_task.h"
#include "components/offline_pages/core/background/pick_request_task.h"
#include "components/offline_pages/core/background/reconcile_task.h"
#include "components/offline_pages/core/background/remove_requests_task.h"
#include "components/offline_pages/core/background/request_queue_store.h"
#include "components/offline_pages/core/background/save_page_request.h"
#include "components/offline_pages/task/closure_task.h"
namespace offline_pages {
namespace {
void GetRequestsDone(RequestQueue::GetRequestsCallback callback,
bool success,
std::vector<std::unique_ptr<SavePageRequest>> requests) { … }
}
RequestQueue::RequestQueue(std::unique_ptr<RequestQueueStore> store)
: … { … }
RequestQueue::~RequestQueue() { … }
void RequestQueue::OnTaskQueueIsIdle() { … }
void RequestQueue::GetRequests(GetRequestsCallback callback) { … }
void RequestQueue::AddRequest(const SavePageRequest& request,
AddOptions options,
AddRequestCallback callback) { … }
void RequestQueue::RemoveRequests(const std::vector<int64_t>& request_ids,
UpdateCallback callback) { … }
void RequestQueue::RemoveRequestsIf(
const base::RepeatingCallback<bool(const SavePageRequest&)>&
remove_predicate,
UpdateCallback done_callback) { … }
void RequestQueue::ChangeRequestsState(
const std::vector<int64_t>& request_ids,
const SavePageRequest::RequestState new_state,
UpdateCallback callback) { … }
void RequestQueue::MarkAttemptStarted(int64_t request_id,
UpdateCallback callback) { … }
void RequestQueue::MarkAttemptAborted(int64_t request_id,
UpdateCallback callback) { … }
void RequestQueue::MarkAttemptCompleted(int64_t request_id,
FailState fail_state,
UpdateCallback callback) { … }
void RequestQueue::SetAutoFetchNotificationState(
int64_t request_id,
SavePageRequest::AutoFetchNotificationState state,
base::OnceCallback<void(bool updated)> callback) { … }
void RequestQueue::MarkAttemptDeferred(int64_t request_id,
UpdateCallback callback) { … }
void RequestQueue::PickNextRequest(
OfflinerPolicy* policy,
PickRequestTask::RequestPickedCallback picked_callback,
PickRequestTask::RequestNotPickedCallback not_picked_callback,
DeviceConditions conditions,
const std::set<int64_t>& disabled_requests,
base::circular_deque<int64_t>* prioritized_requests) { … }
void RequestQueue::ReconcileRequests(UpdateCallback callback) { … }
void RequestQueue::CleanupRequestQueue() { … }
void RequestQueue::Initialize() { … }
void RequestQueue::InitializeStoreDone(bool success) { … }
}