Commit 638d2c19 authored by tzik's avatar tzik Committed by Commit bot

[SyncFS] Run RemoteToLocalSyncer as a background task

BUG=344769

Review URL: https://codereview.chromium.org/554213002

Cr-Commit-Position: refs/heads/master@{#296356}
parent b171b53a
...@@ -290,7 +290,7 @@ void LocalToRemoteSyncer::ContinueAsBackgroundTask( ...@@ -290,7 +290,7 @@ void LocalToRemoteSyncer::ContinueAsBackgroundTask(
// and may delete FileTracker. So, ensure |change_id| is not changed and // and may delete FileTracker. So, ensure |change_id| is not changed and
// check if FileTracker still exists. // check if FileTracker still exists.
// - For UninstallAppTask, it may also delete FileMetadata and FileTracker. // - For UninstallAppTask, it may also delete FileMetadata and FileTracker.
// And also, check if FileTracker still exists. // Check if FileTracker still exists.
// - Others, SyncEngineInitializer and RegisterAppTask doesn't affect to // - Others, SyncEngineInitializer and RegisterAppTask doesn't affect to
// LocalToRemoteSyncer. // LocalToRemoteSyncer.
if (remote_file_tracker_) { if (remote_file_tracker_) {
...@@ -663,8 +663,7 @@ void LocalToRemoteSyncer::DidUploadNewFile( ...@@ -663,8 +663,7 @@ void LocalToRemoteSyncer::DidUploadNewFile(
SyncCompleted(token.Pass(), status); SyncCompleted(token.Pass(), status);
} }
void LocalToRemoteSyncer::CreateRemoteFolder( void LocalToRemoteSyncer::CreateRemoteFolder(scoped_ptr<SyncTaskToken> token) {
scoped_ptr<SyncTaskToken> token) {
DCHECK(remote_parent_folder_tracker_); DCHECK(remote_parent_folder_tracker_);
base::FilePath title = storage::VirtualPath::BaseName(target_path_); base::FilePath title = storage::VirtualPath::BaseName(target_path_);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h"
#include "chrome/browser/sync_file_system/remote_change_processor.h" #include "chrome/browser/sync_file_system/remote_change_processor.h"
#include "chrome/browser/sync_file_system/sync_action.h" #include "chrome/browser/sync_file_system/sync_action.h"
#include "chrome/browser/sync_file_system/sync_callbacks.h" #include "chrome/browser/sync_file_system/sync_callbacks.h"
...@@ -41,6 +42,8 @@ class SyncEngineContext; ...@@ -41,6 +42,8 @@ class SyncEngineContext;
class RemoteToLocalSyncer : public SyncTask { class RemoteToLocalSyncer : public SyncTask {
public: public:
typedef SyncTaskManager::Continuation Continuation;
// Conflicting trackers will have low priority for RemoteToLocalSyncer so that // Conflicting trackers will have low priority for RemoteToLocalSyncer so that
// it should be resolved by LocatToRemoteSyncer. // it should be resolved by LocatToRemoteSyncer.
explicit RemoteToLocalSyncer(SyncEngineContext* sync_context); explicit RemoteToLocalSyncer(SyncEngineContext* sync_context);
...@@ -102,6 +105,11 @@ class RemoteToLocalSyncer : public SyncTask { ...@@ -102,6 +105,11 @@ class RemoteToLocalSyncer : public SyncTask {
// - Dispatch to HandleOfflineSolvable() // - Dispatch to HandleOfflineSolvable()
void ResolveRemoteChange(scoped_ptr<SyncTaskToken> token); void ResolveRemoteChange(scoped_ptr<SyncTaskToken> token);
void MoveToBackground(scoped_ptr<SyncTaskToken> token,
const Continuation& continuation);
void ContinueAsBackgroundTask(const Continuation& continuation,
scoped_ptr<SyncTaskToken> token);
// Handles missing remote metadata case. // Handles missing remote metadata case.
// Fetches remote metadata and updates MetadataDatabase by that. The sync // Fetches remote metadata and updates MetadataDatabase by that. The sync
// operation itself will be deferred to the next sync round. // operation itself will be deferred to the next sync round.
...@@ -132,8 +140,6 @@ class RemoteToLocalSyncer : public SyncTask { ...@@ -132,8 +140,6 @@ class RemoteToLocalSyncer : public SyncTask {
void DidPrepareForFolderUpdate(scoped_ptr<SyncTaskToken> token, void DidPrepareForFolderUpdate(scoped_ptr<SyncTaskToken> token,
SyncStatusCode status); SyncStatusCode status);
void HandleSyncRootDeletion(scoped_ptr<SyncTaskToken> token);
// Handles deleted remote file. Needs Prepare() call. // Handles deleted remote file. Needs Prepare() call.
// If the deleted tracker is the sync-root: // If the deleted tracker is the sync-root:
// - TODO(tzik): Needs special handling. // - TODO(tzik): Needs special handling.
...@@ -150,6 +156,8 @@ class RemoteToLocalSyncer : public SyncTask { ...@@ -150,6 +156,8 @@ class RemoteToLocalSyncer : public SyncTask {
void DidPrepareForDeletion(scoped_ptr<SyncTaskToken> token, void DidPrepareForDeletion(scoped_ptr<SyncTaskToken> token,
SyncStatusCode status); SyncStatusCode status);
void HandleFileMove(scoped_ptr<SyncTaskToken> token);
// Handles new file. Needs Prepare() call. // Handles new file. Needs Prepare() call.
void HandleContentUpdate(scoped_ptr<SyncTaskToken> token); void HandleContentUpdate(scoped_ptr<SyncTaskToken> token);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment