OLD | NEW |
---|---|
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/remote_to_local_syncer.h " | 5 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h " |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 return; | 321 return; |
322 } | 322 } |
323 | 323 |
324 if (!entry) { | 324 if (!entry) { |
325 NOTREACHED(); | 325 NOTREACHED(); |
326 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED); | 326 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED); |
327 return; | 327 return; |
328 } | 328 } |
329 | 329 |
330 status = metadata_database()->UpdateByFileResource(*entry); | 330 status = metadata_database()->UpdateByFileResource(*entry); |
331 // TODO(tzik): Expand this function. | |
332 DidUpdateDatabaseForRemoteMetadata(token.Pass(), status); | |
333 } | |
334 | |
335 void RemoteToLocalSyncer::DidUpdateDatabaseForRemoteMetadata( | |
336 scoped_ptr<SyncTaskToken> token, | |
337 SyncStatusCode status) { | |
338 if (status != SYNC_STATUS_OK) { | 331 if (status != SYNC_STATUS_OK) { |
339 SyncCompleted(token.Pass(), status); | 332 SyncCompleted(token.Pass(), status); |
340 return; | 333 return; |
341 } | 334 } |
342 | 335 |
343 metadata_database()->PromoteDemotedTracker(dirty_tracker_->tracker_id()); | 336 metadata_database()->PromoteDemotedTracker(dirty_tracker_->tracker_id()); |
344 | 337 |
345 // Do not update |dirty_tracker_|. | 338 // Do not update |dirty_tracker_|. |
346 SyncCompleted(token.Pass(), SYNC_STATUS_RETRY); | 339 SyncCompleted(token.Pass(), SYNC_STATUS_RETRY); |
347 } | 340 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 updated_details.set_md5(dirty_tracker_->synced_details().md5()); | 615 updated_details.set_md5(dirty_tracker_->synced_details().md5()); |
623 if (!dirty_tracker_->active()) { | 616 if (!dirty_tracker_->active()) { |
624 // Keep missing true, as the change hasn't been synced to local. | 617 // Keep missing true, as the change hasn't been synced to local. |
625 updated_details.clear_md5(); | 618 updated_details.clear_md5(); |
626 updated_details.set_missing(true); | 619 updated_details.set_missing(true); |
627 } | 620 } |
628 } | 621 } |
629 | 622 |
630 status = metadata_database()->UpdateTracker( | 623 status = metadata_database()->UpdateTracker( |
631 dirty_tracker_->tracker_id(), updated_details); | 624 dirty_tracker_->tracker_id(), updated_details); |
632 // TODO(tzik): Expand this function. | |
tzik
2014/09/10 01:38:16
Note: FinalizeSync is called from other places. So
peria
2014/09/10 01:59:01
Acknowledged.
| |
633 FinalizeSync(token.Pass(), status); | 625 FinalizeSync(token.Pass(), status); |
634 } | 626 } |
635 | 627 |
636 void RemoteToLocalSyncer::FinalizeSync(scoped_ptr<SyncTaskToken> token, | 628 void RemoteToLocalSyncer::FinalizeSync(scoped_ptr<SyncTaskToken> token, |
637 SyncStatusCode status) { | 629 SyncStatusCode status) { |
638 if (prepared_) { | 630 if (prepared_) { |
639 remote_change_processor()->FinalizeRemoteSync( | 631 remote_change_processor()->FinalizeRemoteSync( |
640 url_, false /* clear_local_change */, | 632 url_, false /* clear_local_change */, |
641 base::Bind(SyncTaskManager::NotifyTaskDone, | 633 base::Bind(SyncTaskManager::NotifyTaskDone, |
642 base::Passed(&token), status)); | 634 base::Passed(&token), status)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 | 752 |
761 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( | 753 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( |
762 scoped_ptr<SyncTaskToken> token) { | 754 scoped_ptr<SyncTaskToken> token) { |
763 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, | 755 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, |
764 weak_ptr_factory_.GetWeakPtr(), | 756 weak_ptr_factory_.GetWeakPtr(), |
765 base::Passed(&token)); | 757 base::Passed(&token)); |
766 } | 758 } |
767 | 759 |
768 } // namespace drive_backend | 760 } // namespace drive_backend |
769 } // namespace sync_file_system | 761 } // namespace sync_file_system |
OLD | NEW |