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

Unified Diff: chrome/browser/sync_file_system/local/local_file_sync_context.cc

Issue 389983002: [SyncFS] Interface clean up around LocalfileSyncContext::GetFileForLocalSync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync_file_system/local/local_file_sync_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/local/local_file_sync_context.cc
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
index bf75b1f88c6cfd5c1b259cb9e4468d66b955b31a..743e075c45ccf1f690898d8b22295d06f3b419c9 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
@@ -107,15 +107,13 @@ void LocalFileSyncContext::GetFileForLocalSync(
DCHECK(file_system_context);
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
- std::deque<FileSystemURL>* urls = new std::deque<FileSystemURL>;
- file_system_context->default_file_task_runner()->PostTaskAndReply(
+ base::PostTaskAndReplyWithResult(
+ file_system_context->default_file_task_runner(),
FROM_HERE,
base::Bind(&LocalFileSyncContext::GetNextURLsForSyncOnFileThread,
- this, make_scoped_refptr(file_system_context),
- base::Unretained(urls)),
+ this, make_scoped_refptr(file_system_context)),
base::Bind(&LocalFileSyncContext::TryPrepareForLocalSync,
- this, make_scoped_refptr(file_system_context),
- base::Owned(urls), callback));
+ this, make_scoped_refptr(file_system_context), callback));
}
void LocalFileSyncContext::ClearChangesForURL(
@@ -762,9 +760,9 @@ void LocalFileSyncContext::DidInitialize(
pending_initialize_callbacks_.erase(file_system_context);
}
-void LocalFileSyncContext::GetNextURLsForSyncOnFileThread(
- FileSystemContext* file_system_context,
- std::deque<FileSystemURL>* urls) {
+scoped_ptr<LocalFileSyncContext::FileSystemURLQueue>
+LocalFileSyncContext::GetNextURLsForSyncOnFileThread(
+ FileSystemContext* file_system_context) {
DCHECK(file_system_context);
DCHECK(file_system_context->default_file_task_runner()->
RunsTasksOnCurrentThread());
@@ -772,14 +770,16 @@ void LocalFileSyncContext::GetNextURLsForSyncOnFileThread(
SyncFileSystemBackend::GetBackend(file_system_context);
DCHECK(backend);
DCHECK(backend->change_tracker());
+ scoped_ptr<FileSystemURLQueue> urls(new FileSystemURLQueue);
backend->change_tracker()->GetNextChangedURLs(
- urls, kMaxURLsToFetchForLocalSync);
+ urls.get(), kMaxURLsToFetchForLocalSync);
+ return urls.Pass();
}
void LocalFileSyncContext::TryPrepareForLocalSync(
FileSystemContext* file_system_context,
- std::deque<FileSystemURL>* urls,
- const LocalFileSyncInfoCallback& callback) {
+ const LocalFileSyncInfoCallback& callback,
+ scoped_ptr<FileSystemURLQueue> urls) {
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
DCHECK(urls);
@@ -797,19 +797,17 @@ void LocalFileSyncContext::TryPrepareForLocalSync(
const FileSystemURL url = urls->front();
urls->pop_front();
- std::deque<FileSystemURL>* remaining = new std::deque<FileSystemURL>;
- remaining->swap(*urls);
PrepareForSync(
file_system_context, url, SYNC_SNAPSHOT,
base::Bind(&LocalFileSyncContext::DidTryPrepareForLocalSync,
this, make_scoped_refptr(file_system_context),
- base::Owned(remaining), callback));
+ base::Passed(&urls), callback));
}
void LocalFileSyncContext::DidTryPrepareForLocalSync(
FileSystemContext* file_system_context,
- std::deque<FileSystemURL>* remaining_urls,
+ scoped_ptr<FileSystemURLQueue> remaining_urls,
const LocalFileSyncInfoCallback& callback,
SyncStatusCode status,
const LocalFileSyncInfo& sync_file_info,
@@ -820,7 +818,7 @@ void LocalFileSyncContext::DidTryPrepareForLocalSync(
return;
}
// Recursively call TryPrepareForLocalSync with remaining_urls.
- TryPrepareForLocalSync(file_system_context, remaining_urls, callback);
+ TryPrepareForLocalSync(file_system_context, callback, remaining_urls.Pass());
}
void LocalFileSyncContext::DidGetWritingStatusForSync(
« no previous file with comments | « chrome/browser/sync_file_system/local/local_file_sync_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698