#include "components/offline_pages/core/background/pick_request_task.h"
#include <memory>
#include <unordered_set>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/time/time.h"
#include "components/offline_pages/core/background/device_conditions.h"
#include "components/offline_pages/core/background/offliner_policy.h"
#include "components/offline_pages/core/background/offliner_policy_utils.h"
#include "components/offline_pages/core/background/request_coordinator_event_logger.h"
#include "components/offline_pages/core/background/request_notifier.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/core/offline_clock.h"
#include "components/offline_pages/core/offline_page_client_policy.h"
namespace {
template <typename T>
int signum(T t) { … }
bool kCleanupNeeded = …;
bool kNonUserRequestsFound = …;
#define CALL_MEMBER_FUNCTION(object, ptrToMember) …
}
namespace offline_pages {
const base::TimeDelta PickRequestTask::kDeferInterval = …;
PickRequestTask::PickRequestTask(
RequestQueueStore* store,
OfflinerPolicy* policy,
RequestPickedCallback picked_callback,
RequestNotPickedCallback not_picked_callback,
DeviceConditions device_conditions,
const std::set<int64_t>& disabled_requests,
base::circular_deque<int64_t>* prioritized_requests)
: … { … }
PickRequestTask::~PickRequestTask() { … }
void PickRequestTask::Run() { … }
void PickRequestTask::GetRequests() { … }
void PickRequestTask::Choose(
bool success,
std::vector<std::unique_ptr<SavePageRequest>> requests) { … }
bool PickRequestTask::RequestConditionsSatisfied(
const SavePageRequest& request) { … }
bool PickRequestTask::IsNewRequestBetter(const SavePageRequest& oldRequest,
const SavePageRequest& newRequest,
RequestCompareFunction comparator) { … }
bool PickRequestTask::RetryCountFirstCompareFunction(
const SavePageRequest& left,
const SavePageRequest& right) { … }
bool PickRequestTask::RecencyFirstCompareFunction(
const SavePageRequest& left,
const SavePageRequest& right) { … }
int PickRequestTask::CompareRetryCount(const SavePageRequest& left,
const SavePageRequest& right) { … }
int PickRequestTask::CompareCreationTime(const SavePageRequest& left,
const SavePageRequest& right) { … }
}