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

Side by Side Diff: chrome/browser/sync/glue/database_model_worker.cc

Issue 7891054: Add GROUP_FILE ModelSafeGroup (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix worker count in unittest 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/glue/database_model_worker.h"
6
7 #include "base/synchronization/waitable_event.h"
8 #include "content/browser/browser_thread.h"
9
10 using base::WaitableEvent;
11
12 namespace browser_sync {
13
14 void DatabaseModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
15 if (BrowserThread::CurrentlyOn(BrowserThread::DB)) {
16 DLOG(WARNING) << "DoWorkAndWaitUntilDone called from the DB thread.";
17 work->Run();
18 return;
19 }
20 WaitableEvent done(false, false);
21 if (!BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
22 NewRunnableMethod(this, &DatabaseModelWorker::CallDoWorkAndSignalTask,
23 work, &done))) {
24 NOTREACHED() << "Failed to post task to the db thread.";
25 return;
26 }
27 done.Wait();
28 }
29
30 void DatabaseModelWorker::CallDoWorkAndSignalTask(Callback0::Type* work,
31 WaitableEvent* done) {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
33 work->Run();
34 done->Signal();
35 }
36
37 ModelSafeGroup DatabaseModelWorker::GetModelSafeGroup() {
38 return GROUP_DB;
39 }
40
41 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/database_model_worker.h ('k') | chrome/browser/sync/glue/database_model_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698