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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 token->RecordLog("Detected a new folder."); | 244 token->RecordLog("Detected a new folder."); |
245 MoveToBackground(base::Bind(&LocalToRemoteSyncer::CreateRemoteFolder, | 245 MoveToBackground(base::Bind(&LocalToRemoteSyncer::CreateRemoteFolder, |
246 weak_ptr_factory_.GetWeakPtr()), | 246 weak_ptr_factory_.GetWeakPtr()), |
247 token.Pass()); | 247 token.Pass()); |
248 } | 248 } |
249 | 249 |
250 void LocalToRemoteSyncer::MoveToBackground(const Continuation& continuation, | 250 void LocalToRemoteSyncer::MoveToBackground(const Continuation& continuation, |
251 scoped_ptr<SyncTaskToken> token) { | 251 scoped_ptr<SyncTaskToken> token) { |
252 scoped_ptr<BlockingFactor> blocker(new BlockingFactor); | 252 scoped_ptr<TaskBlocker> blocker(new TaskBlocker); |
253 blocker->app_id = url_.origin().host(); | 253 blocker->app_id = url_.origin().host(); |
254 blocker->paths.push_back(target_path_); | 254 blocker->paths.push_back(target_path_); |
255 | 255 |
256 if (remote_file_tracker_) { | 256 if (remote_file_tracker_) { |
257 if (!GetKnownChangeID(metadata_database(), | 257 if (!GetKnownChangeID(metadata_database(), |
258 remote_file_tracker_->file_id(), | 258 remote_file_tracker_->file_id(), |
259 &remote_file_change_id_)) { | 259 &remote_file_change_id_)) { |
260 NOTREACHED(); | 260 NOTREACHED(); |
261 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED); | 261 SyncCompleted(token.Pass(), SYNC_STATUS_FAILED); |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 blocker->tracker_ids.push_back(remote_file_tracker_->tracker_id()); | 265 blocker->tracker_ids.push_back(remote_file_tracker_->tracker_id()); |
266 blocker->file_ids.push_back(remote_file_tracker_->file_id()); | 266 blocker->file_ids.push_back(remote_file_tracker_->file_id()); |
267 } | 267 } |
268 | 268 |
269 // Run current task as a background task with |blocker|. | 269 // Run current task as a background task with |blocker|. |
270 // After the invocation of ContinueAsBackgroundTask | 270 // After the invocation of ContinueAsBackgroundTask |
271 SyncTaskManager::UpdateBlockingFactor( | 271 SyncTaskManager::UpdateTaskBlocker( |
272 token.Pass(), blocker.Pass(), | 272 token.Pass(), blocker.Pass(), |
273 base::Bind(&LocalToRemoteSyncer::ContinueAsBackgroundTask, | 273 base::Bind(&LocalToRemoteSyncer::ContinueAsBackgroundTask, |
274 weak_ptr_factory_.GetWeakPtr(), | 274 weak_ptr_factory_.GetWeakPtr(), |
275 continuation)); | 275 continuation)); |
276 } | 276 } |
277 | 277 |
278 void LocalToRemoteSyncer::ContinueAsBackgroundTask( | 278 void LocalToRemoteSyncer::ContinueAsBackgroundTask( |
279 const Continuation& continuation, | 279 const Continuation& continuation, |
280 scoped_ptr<SyncTaskToken> token) { | 280 scoped_ptr<SyncTaskToken> token) { |
281 // The SyncTask runs as a background task beyond this point. | 281 // The SyncTask runs as a background task beyond this point. |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 set_used_network(true); | 772 set_used_network(true); |
773 return sync_context_->GetDriveUploader(); | 773 return sync_context_->GetDriveUploader(); |
774 } | 774 } |
775 | 775 |
776 MetadataDatabase* LocalToRemoteSyncer::metadata_database() { | 776 MetadataDatabase* LocalToRemoteSyncer::metadata_database() { |
777 return sync_context_->GetMetadataDatabase(); | 777 return sync_context_->GetMetadataDatabase(); |
778 } | 778 } |
779 | 779 |
780 } // namespace drive_backend | 780 } // namespace drive_backend |
781 } // namespace sync_file_system | 781 } // namespace sync_file_system |
OLD | NEW |