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

Unified Diff: chrome/browser/chromeos/drive/sync_client.cc

Issue 372713004: Wait for parent directory sync before performing server-side copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add operation_observer.cc 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/chromeos/drive/sync_client.h ('k') | chrome/browser/chromeos/drive/sync_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/sync_client.cc
diff --git a/chrome/browser/chromeos/drive/sync_client.cc b/chrome/browser/chromeos/drive/sync_client.cc
index 52049d52248d7e39d86a9aec3c25250b713fe9c6..51b2b422c2b9a35a312a38e2dcf5a81472d46aaf 100644
--- a/chrome/browser/chromeos/drive/sync_client.cc
+++ b/chrome/browser/chromeos/drive/sync_client.cc
@@ -232,6 +232,20 @@ void SyncClient::AddUpdateTask(const ClientContext& context,
AddUpdateTaskInternal(context, local_id, delay_);
}
+bool SyncClient:: WaitForUpdateTaskToComplete(
+ const std::string& local_id,
+ const FileOperationCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ SyncTasks::iterator it = tasks_.find(SyncTasks::key_type(UPDATE, local_id));
+ if (it == tasks_.end())
+ return false;
+
+ SyncTask* task = &it->second;
+ task->waiting_callbacks.push_back(callback);
+ return true;
+}
+
base::Closure SyncClient::PerformFetchTask(const std::string& local_id,
const ClientContext& context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -439,6 +453,12 @@ void SyncClient::OnTaskComplete(SyncType type,
<< ": " << FileErrorToString(error);
}
+ for (size_t i = 0; i < it->second.waiting_callbacks.size(); ++i) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(it->second.waiting_callbacks[i], error));
+ }
+ it->second.waiting_callbacks.clear();
+
if (it->second.should_run_again) {
DVLOG(1) << "Running again: type = " << type << ", id = " << local_id;
it->second.state = PENDING;
« no previous file with comments | « chrome/browser/chromeos/drive/sync_client.h ('k') | chrome/browser/chromeos/drive/sync_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698