Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc

Issue 554213002: [SyncFS] Run RemoteToLocalSyncer as a background task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h " 5 #include "chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h "
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // ContinueAsBackgroundTask(), so we need to make sure other tasks didn't 283 // ContinueAsBackgroundTask(), so we need to make sure other tasks didn't
284 // affect to the current LocalToRemoteSyncer task. 284 // affect to the current LocalToRemoteSyncer task.
285 // 285 //
286 // - For RemoteToLocalSyncer, it doesn't actually run beyond 286 // - For RemoteToLocalSyncer, it doesn't actually run beyond
287 // PrepareForProcessRemoteChange() since it should be blocked in 287 // PrepareForProcessRemoteChange() since it should be blocked in
288 // LocalFileSyncService. 288 // LocalFileSyncService.
289 // - For ListChangesTask, it may update FileMetatada together with |change_id| 289 // - For ListChangesTask, it may update FileMetatada together with |change_id|
290 // and may delete FileTracker. So, ensure |change_id| is not changed and 290 // and may delete FileTracker. So, ensure |change_id| is not changed and
291 // check if FileTracker still exists. 291 // check if FileTracker still exists.
292 // - For UninstallAppTask, it may also delete FileMetadata and FileTracker. 292 // - For UninstallAppTask, it may also delete FileMetadata and FileTracker.
293 // And also, check if FileTracker still exists. 293 // Check if FileTracker still exists.
294 // - Others, SyncEngineInitializer and RegisterAppTask doesn't affect to 294 // - Others, SyncEngineInitializer and RegisterAppTask doesn't affect to
295 // LocalToRemoteSyncer. 295 // LocalToRemoteSyncer.
296 if (remote_file_tracker_) { 296 if (remote_file_tracker_) {
297 int64 latest_change_id = 0; 297 int64 latest_change_id = 0;
298 if (!GetKnownChangeID(metadata_database(), 298 if (!GetKnownChangeID(metadata_database(),
299 remote_file_tracker_->file_id(), 299 remote_file_tracker_->file_id(),
300 &latest_change_id) || 300 &latest_change_id) ||
301 latest_change_id > remote_file_change_id_) { 301 latest_change_id > remote_file_change_id_) {
302 SyncCompleted(token.Pass(), SYNC_STATUS_RETRY); 302 SyncCompleted(token.Pass(), SYNC_STATUS_RETRY);
303 return; 303 return;
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 NOTREACHED(); 656 NOTREACHED();
657 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED); 657 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED);
658 return; 658 return;
659 } 659 }
660 660
661 status = metadata_database()->ReplaceActiveTrackerWithNewResource( 661 status = metadata_database()->ReplaceActiveTrackerWithNewResource(
662 remote_parent_folder_tracker_->tracker_id(), *entry); 662 remote_parent_folder_tracker_->tracker_id(), *entry);
663 SyncCompleted(token.Pass(), status); 663 SyncCompleted(token.Pass(), status);
664 } 664 }
665 665
666 void LocalToRemoteSyncer::CreateRemoteFolder( 666 void LocalToRemoteSyncer::CreateRemoteFolder(scoped_ptr<SyncTaskToken> token) {
667 scoped_ptr<SyncTaskToken> token) {
668 DCHECK(remote_parent_folder_tracker_); 667 DCHECK(remote_parent_folder_tracker_);
669 668
670 base::FilePath title = storage::VirtualPath::BaseName(target_path_); 669 base::FilePath title = storage::VirtualPath::BaseName(target_path_);
671 sync_action_ = SYNC_ACTION_ADDED; 670 sync_action_ = SYNC_ACTION_ADDED;
672 671
673 DCHECK(!folder_creator_); 672 DCHECK(!folder_creator_);
674 folder_creator_.reset(new FolderCreator( 673 folder_creator_.reset(new FolderCreator(
675 drive_service(), metadata_database(), 674 drive_service(), metadata_database(),
676 remote_parent_folder_tracker_->file_id(), 675 remote_parent_folder_tracker_->file_id(),
677 title.AsUTF8Unsafe())); 676 title.AsUTF8Unsafe()));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 set_used_network(true); 745 set_used_network(true);
747 return sync_context_->GetDriveUploader(); 746 return sync_context_->GetDriveUploader();
748 } 747 }
749 748
750 MetadataDatabase* LocalToRemoteSyncer::metadata_database() { 749 MetadataDatabase* LocalToRemoteSyncer::metadata_database() {
751 return sync_context_->GetMetadataDatabase(); 750 return sync_context_->GetMetadataDatabase();
752 } 751 }
753 752
754 } // namespace drive_backend 753 } // namespace drive_backend
755 } // namespace sync_file_system 754 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698