#include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/task/sequenced_task_runner.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h"
#include "chrome/browser/sync_file_system/sync_file_metadata.h"
FileSystemURL;
namespace sync_file_system {
namespace drive_backend {
namespace {
class SyncTaskAdapter : public ExclusiveTask { … };
}
SyncTaskManager::PendingTask::PendingTask() = default;
SyncTaskManager::PendingTask::PendingTask(base::OnceClosure task,
Priority pri,
int seq)
: … { … }
SyncTaskManager::PendingTask::PendingTask(PendingTask&& other) = default;
SyncTaskManager::PendingTask& SyncTaskManager::PendingTask::operator=(
PendingTask&& other) = default;
SyncTaskManager::PendingTask::~PendingTask() { … }
bool SyncTaskManager::PendingTaskComparator::operator()(
const PendingTask& left,
const PendingTask& right) const { … }
SyncTaskManager::SyncTaskManager(
base::WeakPtr<Client> client,
size_t maximum_background_task,
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: … { … }
SyncTaskManager::~SyncTaskManager() { … }
void SyncTaskManager::Initialize(SyncStatusCode status) { … }
void SyncTaskManager::ScheduleTask(const base::Location& from_here,
Task task,
Priority priority,
SyncStatusCallback callback) { … }
void SyncTaskManager::ScheduleSyncTask(const base::Location& from_here,
std::unique_ptr<SyncTask> task,
Priority priority,
SyncStatusCallback callback) { … }
bool SyncTaskManager::ScheduleTaskIfIdle(const base::Location& from_here,
Task task,
SyncStatusCallback callback) { … }
bool SyncTaskManager::ScheduleSyncTaskIfIdle(const base::Location& from_here,
std::unique_ptr<SyncTask> task,
SyncStatusCallback callback) { … }
void SyncTaskManager::NotifyTaskDone(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void SyncTaskManager::UpdateTaskBlocker(
std::unique_ptr<SyncTaskToken> current_task_token,
std::unique_ptr<TaskBlocker> task_blocker,
Continuation continuation) { … }
bool SyncTaskManager::IsRunningTask(int64_t token_id) const { … }
void SyncTaskManager::DetachFromSequence() { … }
void SyncTaskManager::NotifyTaskDoneBody(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void SyncTaskManager::UpdateTaskBlockerBody(
std::unique_ptr<SyncTaskToken> foreground_task_token,
std::unique_ptr<SyncTaskToken> background_task_token,
std::unique_ptr<TaskLogger::TaskLog> task_log,
std::unique_ptr<TaskBlocker> task_blocker,
Continuation continuation) { … }
std::unique_ptr<SyncTaskToken> SyncTaskManager::GetUnupdatedToken() { … }
void SyncTaskManager::PushPendingTask(base::OnceClosure closure,
Priority priority) { … }
void SyncTaskManager::RunTask(std::unique_ptr<SyncTaskToken> token,
std::unique_ptr<SyncTask> task) { … }
void SyncTaskManager::MaybeStartNextForegroundTask(
std::unique_ptr<SyncTaskToken> token) { … }
}
}