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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_context.cc

Issue 1545283002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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/local/local_file_sync_context.h" 5 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
11 #include "base/stl_util.h" 13 #include "base/stl_util.h"
12 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
13 #include "chrome/browser/sync_file_system/file_change.h" 15 #include "chrome/browser/sync_file_system/file_change.h"
14 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" 16 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
15 #include "chrome/browser/sync_file_system/local/local_origin_change_observer.h" 17 #include "chrome/browser/sync_file_system/local/local_origin_change_observer.h"
16 #include "chrome/browser/sync_file_system/local/root_delete_helper.h" 18 #include "chrome/browser/sync_file_system/local/root_delete_helper.h"
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 if (shutdown_on_io_) 734 if (shutdown_on_io_)
733 status = SYNC_STATUS_ABORT; 735 status = SYNC_STATUS_ABORT;
734 if (status != SYNC_STATUS_OK) { 736 if (status != SYNC_STATUS_OK) {
735 DidInitialize(source_url, file_system_context, status); 737 DidInitialize(source_url, file_system_context, status);
736 return; 738 return;
737 } 739 }
738 740
739 SyncFileSystemBackend* backend = 741 SyncFileSystemBackend* backend =
740 SyncFileSystemBackend::GetBackend(file_system_context); 742 SyncFileSystemBackend::GetBackend(file_system_context);
741 DCHECK(backend); 743 DCHECK(backend);
742 backend->SetLocalFileChangeTracker(tracker_ptr->Pass()); 744 backend->SetLocalFileChangeTracker(std::move(*tracker_ptr));
743 745
744 origins_with_pending_changes_.insert(origins_with_changes->begin(), 746 origins_with_pending_changes_.insert(origins_with_changes->begin(),
745 origins_with_changes->end()); 747 origins_with_changes->end());
746 ScheduleNotifyChangesUpdatedOnIOThread(NoopClosure()); 748 ScheduleNotifyChangesUpdatedOnIOThread(NoopClosure());
747 749
748 InitializeFileSystemContextOnIOThread(source_url, file_system_context, 750 InitializeFileSystemContextOnIOThread(source_url, file_system_context,
749 GURL(), std::string(), 751 GURL(), std::string(),
750 base::File::FILE_OK); 752 base::File::FILE_OK);
751 } 753 }
752 754
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 SyncFileSystemBackend::GetBackend(file_system_context); 794 SyncFileSystemBackend::GetBackend(file_system_context);
793 DCHECK(backend); 795 DCHECK(backend);
794 DCHECK(backend->change_tracker()); 796 DCHECK(backend->change_tracker());
795 scoped_ptr<FileSystemURLQueue> urls(new FileSystemURLQueue); 797 scoped_ptr<FileSystemURLQueue> urls(new FileSystemURLQueue);
796 backend->change_tracker()->GetNextChangedURLs( 798 backend->change_tracker()->GetNextChangedURLs(
797 urls.get(), kMaxURLsToFetchForLocalSync); 799 urls.get(), kMaxURLsToFetchForLocalSync);
798 for (FileSystemURLQueue::iterator iter = urls->begin(); 800 for (FileSystemURLQueue::iterator iter = urls->begin();
799 iter != urls->end(); ++iter) 801 iter != urls->end(); ++iter)
800 backend->change_tracker()->DemoteChangesForURL(*iter); 802 backend->change_tracker()->DemoteChangesForURL(*iter);
801 803
802 return urls.Pass(); 804 return urls;
803 } 805 }
804 806
805 void LocalFileSyncContext::TryPrepareForLocalSync( 807 void LocalFileSyncContext::TryPrepareForLocalSync(
806 FileSystemContext* file_system_context, 808 FileSystemContext* file_system_context,
807 const LocalFileSyncInfoCallback& callback, 809 const LocalFileSyncInfoCallback& callback,
808 scoped_ptr<FileSystemURLQueue> urls) { 810 scoped_ptr<FileSystemURLQueue> urls) {
809 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 811 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
810 DCHECK(urls); 812 DCHECK(urls);
811 813
812 if (shutdown_on_ui_) { 814 if (shutdown_on_ui_) {
(...skipping 21 matching lines...) Expand all
834 void LocalFileSyncContext::DidTryPrepareForLocalSync( 836 void LocalFileSyncContext::DidTryPrepareForLocalSync(
835 FileSystemContext* file_system_context, 837 FileSystemContext* file_system_context,
836 scoped_ptr<FileSystemURLQueue> remaining_urls, 838 scoped_ptr<FileSystemURLQueue> remaining_urls,
837 const LocalFileSyncInfoCallback& callback, 839 const LocalFileSyncInfoCallback& callback,
838 SyncStatusCode status, 840 SyncStatusCode status,
839 const LocalFileSyncInfo& sync_file_info, 841 const LocalFileSyncInfo& sync_file_info,
840 storage::ScopedFile snapshot) { 842 storage::ScopedFile snapshot) {
841 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 843 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
842 if (status != SYNC_STATUS_FILE_BUSY) { 844 if (status != SYNC_STATUS_FILE_BUSY) {
843 PromoteDemotedChangesForURLs(file_system_context, 845 PromoteDemotedChangesForURLs(file_system_context,
844 remaining_urls.Pass()); 846 std::move(remaining_urls));
845 callback.Run(status, sync_file_info, snapshot.Pass()); 847 callback.Run(status, sync_file_info, std::move(snapshot));
846 return; 848 return;
847 } 849 }
848 850
849 PromoteDemotedChangesForURL(file_system_context, sync_file_info.url); 851 PromoteDemotedChangesForURL(file_system_context, sync_file_info.url);
850 852
851 // Recursively call TryPrepareForLocalSync with remaining_urls. 853 // Recursively call TryPrepareForLocalSync with remaining_urls.
852 TryPrepareForLocalSync(file_system_context, callback, remaining_urls.Pass()); 854 TryPrepareForLocalSync(file_system_context, callback,
855 std::move(remaining_urls));
853 } 856 }
854 857
855 void LocalFileSyncContext::PromoteDemotedChangesForURL( 858 void LocalFileSyncContext::PromoteDemotedChangesForURL(
856 FileSystemContext* file_system_context, 859 FileSystemContext* file_system_context,
857 const FileSystemURL& url) { 860 const FileSystemURL& url) {
858 DCHECK(file_system_context); 861 DCHECK(file_system_context);
859 if (!file_system_context->default_file_task_runner()-> 862 if (!file_system_context->default_file_task_runner()->
860 RunsTasksOnCurrentThread()) { 863 RunsTasksOnCurrentThread()) {
861 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 864 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
862 if (shutdown_on_ui_) 865 if (shutdown_on_ui_)
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return; 1076 return;
1074 } 1077 }
1075 1078
1076 FileSystemURL url_for_sync = CreateSyncableFileSystemURLForSync( 1079 FileSystemURL url_for_sync = CreateSyncableFileSystemURLForSync(
1077 file_system_context, dest_url); 1080 file_system_context, dest_url);
1078 file_system_context->operation_runner()->CopyInForeignFile( 1081 file_system_context->operation_runner()->CopyInForeignFile(
1079 local_path, url_for_sync, callback); 1082 local_path, url_for_sync, callback);
1080 } 1083 }
1081 1084
1082 } // namespace sync_file_system 1085 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698