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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
123 | 123 |
124 dirty_tracker_ = make_scoped_ptr(new FileTracker); | 124 dirty_tracker_ = make_scoped_ptr(new FileTracker); |
125 if (metadata_database()->GetNormalPriorityDirtyTracker( | 125 if (metadata_database()->GetDirtyTracker(dirty_tracker_.get())) { |
126 dirty_tracker_.get())) { | |
127 token->RecordLog(base::StringPrintf( | 126 token->RecordLog(base::StringPrintf( |
128 "Start: tracker_id=%" PRId64, dirty_tracker_->tracker_id())); | 127 "Start: tracker_id=%" PRId64, dirty_tracker_->tracker_id())); |
129 metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id()); | 128 metadata_database()->DemoteTracker(dirty_tracker_->tracker_id()); |
130 ResolveRemoteChange(token.Pass()); | 129 ResolveRemoteChange(token.Pass()); |
131 return; | 130 return; |
132 } | 131 } |
133 | 132 |
134 token->RecordLog("Nothing to do."); | 133 token->RecordLog("Nothing to do."); |
135 SyncTaskManager::NotifyTaskDone(token.Pass(), SYNC_STATUS_NO_CHANGE_TO_SYNC); | 134 SyncTaskManager::NotifyTaskDone(token.Pass(), SYNC_STATUS_NO_CHANGE_TO_SYNC); |
136 } | 135 } |
137 | 136 |
138 void RemoteToLocalSyncer::ResolveRemoteChange(scoped_ptr<SyncTaskToken> token) { | 137 void RemoteToLocalSyncer::ResolveRemoteChange(scoped_ptr<SyncTaskToken> token) { |
139 DCHECK(dirty_tracker_); | 138 DCHECK(dirty_tracker_); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 762 |
764 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( | 763 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( |
765 scoped_ptr<SyncTaskToken> token) { | 764 scoped_ptr<SyncTaskToken> token) { |
766 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, | 765 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, |
767 weak_ptr_factory_.GetWeakPtr(), | 766 weak_ptr_factory_.GetWeakPtr(), |
768 base::Passed(&token)); | 767 base::Passed(&token)); |
769 } | 768 } |
770 | 769 |
771 } // namespace drive_backend | 770 } // namespace drive_backend |
772 } // namespace sync_file_system | 771 } // namespace sync_file_system |
OLD | NEW |