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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service.cc

Issue 268413002: [SyncFS] Make DumpFiles async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync_file_system_service.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 const DumpFilesCallback& callback, 506 const DumpFilesCallback& callback,
507 SyncStatusCode status) { 507 SyncStatusCode status) {
508 DCHECK(!origin.is_empty()); 508 DCHECK(!origin.is_empty());
509 509
510 if (status != SYNC_STATUS_OK) { 510 if (status != SYNC_STATUS_OK) {
511 base::ListValue empty_result; 511 base::ListValue empty_result;
512 callback.Run(&empty_result); 512 callback.Run(&empty_result);
513 return; 513 return;
514 } 514 }
515 515
516 base::ListValue* files = 516 GetRemoteService(origin)->DumpFiles(
517 GetRemoteService(origin)->DumpFiles(origin).release(); 517 origin,
518 base::Bind(
519 &SyncFileSystemService::DidDumpFiles,
520 AsWeakPtr(),
521 origin,
522 callback));
523 }
524
525 void SyncFileSystemService::DidDumpFiles(
526 const GURL& origin,
527 const DumpFilesCallback& callback,
528 scoped_ptr<base::ListValue> dump_files) {
529 base::ListValue* files = dump_files.release();
518 if (!files) { 530 if (!files) {
519 callback.Run(new base::ListValue); 531 callback.Run(new base::ListValue);
520 return; 532 return;
521 } 533 }
522 534
523 if (!files->GetSize()) { 535 if (!files->GetSize()) {
524 callback.Run(files); 536 callback.Run(files);
525 return; 537 return;
526 } 538 }
527 539
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); 788 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get());
777 v2_remote_service_->SetSyncEnabled(sync_enabled_); 789 v2_remote_service_->SetSyncEnabled(sync_enabled_);
778 v2_remote_service_->SetDefaultConflictResolutionPolicy( 790 v2_remote_service_->SetDefaultConflictResolutionPolicy(
779 remote_service_->GetDefaultConflictResolutionPolicy()); 791 remote_service_->GetDefaultConflictResolutionPolicy());
780 remote_sync_runners_.push_back(v2_remote_syncer.release()); 792 remote_sync_runners_.push_back(v2_remote_syncer.release());
781 } 793 }
782 return v2_remote_service_.get(); 794 return v2_remote_service_.get();
783 } 795 }
784 796
785 } // namespace sync_file_system 797 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698