| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 sync_root_deletion_(false), | 99 sync_root_deletion_(false), |
| 100 weak_ptr_factory_(this) { | 100 weak_ptr_factory_(this) { |
| 101 } | 101 } |
| 102 | 102 |
| 103 RemoteToLocalSyncer::~RemoteToLocalSyncer() { | 103 RemoteToLocalSyncer::~RemoteToLocalSyncer() { |
| 104 } | 104 } |
| 105 | 105 |
| 106 void RemoteToLocalSyncer::RunPreflight(scoped_ptr<SyncTaskToken> token) { | 106 void RemoteToLocalSyncer::RunPreflight(scoped_ptr<SyncTaskToken> token) { |
| 107 token->InitializeTaskLog("Remote -> Local"); | 107 token->InitializeTaskLog("Remote -> Local"); |
| 108 | 108 |
| 109 scoped_ptr<BlockingFactor> blocking_factor(new BlockingFactor); | 109 scoped_ptr<TaskBlocker> task_blocker(new TaskBlocker); |
| 110 blocking_factor->exclusive = true; | 110 task_blocker->exclusive = true; |
| 111 SyncTaskManager::UpdateBlockingFactor( | 111 SyncTaskManager::UpdateTaskBlocker( |
| 112 token.Pass(), blocking_factor.Pass(), | 112 token.Pass(), task_blocker.Pass(), |
| 113 base::Bind(&RemoteToLocalSyncer::RunExclusive, | 113 base::Bind(&RemoteToLocalSyncer::RunExclusive, |
| 114 weak_ptr_factory_.GetWeakPtr())); | 114 weak_ptr_factory_.GetWeakPtr())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void RemoteToLocalSyncer::RunExclusive(scoped_ptr<SyncTaskToken> token) { | 117 void RemoteToLocalSyncer::RunExclusive(scoped_ptr<SyncTaskToken> token) { |
| 118 if (!drive_service() || !metadata_database() || !remote_change_processor()) { | 118 if (!drive_service() || !metadata_database() || !remote_change_processor()) { |
| 119 token->RecordLog("Context not ready."); | 119 token->RecordLog("Context not ready."); |
| 120 SyncTaskManager::NotifyTaskDone(token.Pass(), SYNC_STATUS_FAILED); | 120 SyncTaskManager::NotifyTaskDone(token.Pass(), SYNC_STATUS_FAILED); |
| 121 return; | 121 return; |
| 122 } | 122 } |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 763 |
| 764 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( | 764 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( |
| 765 scoped_ptr<SyncTaskToken> token) { | 765 scoped_ptr<SyncTaskToken> token) { |
| 766 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, | 766 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, |
| 767 weak_ptr_factory_.GetWeakPtr(), | 767 weak_ptr_factory_.GetWeakPtr(), |
| 768 base::Passed(&token)); | 768 base::Passed(&token)); |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace drive_backend | 771 } // namespace drive_backend |
| 772 } // namespace sync_file_system | 772 } // namespace sync_file_system |
| OLD | NEW |