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

Unified Diff: chrome/browser/sync/glue/file_model_worker.cc

Issue 7891054: Add GROUP_FILE ModelSafeGroup (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 3 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
Index: chrome/browser/sync/glue/file_model_worker.cc
diff --git a/chrome/browser/sync/glue/file_model_worker.cc b/chrome/browser/sync/glue/file_model_worker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..04b7c22bf688569e13353861d1935a4b804754cd
--- /dev/null
+++ b/chrome/browser/sync/glue/file_model_worker.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/glue/file_model_worker.h"
+
+#include "base/synchronization/waitable_event.h"
+#include "content/browser/browser_thread.h"
+
+using base::WaitableEvent;
+
+namespace browser_sync {
+
+void FileModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
+ if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
+ DLOG(WARNING) << "DoWorkAndWaitUntilDone called from the FILE thread.";
+ work->Run();
+ return;
+ }
+ WaitableEvent done(false, false);
+ if (!BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ NewRunnableMethod(this, &FileModelWorker::CallDoWorkAndSignalTask,
+ work, &done))) {
+ NOTREACHED() << "Failed to post task to the db thread.";
+ return;
+ }
+ done.Wait();
+}
+
+void FileModelWorker::CallDoWorkAndSignalTask(Callback0::Type* work,
+ WaitableEvent* done) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ work->Run();
+ done->Signal();
+}
+
+ModelSafeGroup FileModelWorker::GetModelSafeGroup() {
+ return GROUP_FILE;
+}
+
+} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698