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

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

Issue 8341117: Converted top-level NewRunnable* to Bind for Sync module (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indenting. Removed trailing whitespace. Created 9 years, 1 month 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/glue/browser_thread_model_worker.h" 5 #include "chrome/browser/sync/glue/browser_thread_model_worker.h"
6 6
7 #include "base/bind.h"
7 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
8 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
9 10
10 using base::WaitableEvent; 11 using base::WaitableEvent;
11 12
12 namespace browser_sync { 13 namespace browser_sync {
13 14
14 BrowserThreadModelWorker::BrowserThreadModelWorker( 15 BrowserThreadModelWorker::BrowserThreadModelWorker(
15 BrowserThread::ID thread, ModelSafeGroup group) 16 BrowserThread::ID thread, ModelSafeGroup group)
16 : thread_(thread), group_(group) {} 17 : thread_(thread), group_(group) {}
17 18
18 BrowserThreadModelWorker::~BrowserThreadModelWorker() {} 19 BrowserThreadModelWorker::~BrowserThreadModelWorker() {}
19 20
20 UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone( 21 UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone(
21 const WorkCallback& work) { 22 const WorkCallback& work) {
22 UnrecoverableErrorInfo error_info; 23 UnrecoverableErrorInfo error_info;
23 if (BrowserThread::CurrentlyOn(thread_)) { 24 if (BrowserThread::CurrentlyOn(thread_)) {
24 DLOG(WARNING) << "Already on thread " << thread_; 25 DLOG(WARNING) << "Already on thread " << thread_;
25 return work.Run(); 26 return work.Run();
26 } 27 }
27 WaitableEvent done(false, false); 28 WaitableEvent done(false, false);
28 if (!BrowserThread::PostTask( 29 if (!BrowserThread::PostTask(
29 thread_, 30 thread_,
30 FROM_HERE, 31 FROM_HERE,
31 NewRunnableMethod( 32 base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this,
32 this, 33 work, &done, &error_info))) {
33 &BrowserThreadModelWorker::CallDoWorkAndSignalTask,
34 work,
35 &done,
36 &error_info))) {
37 NOTREACHED() << "Failed to post task to thread " << thread_; 34 NOTREACHED() << "Failed to post task to thread " << thread_;
38 return error_info; 35 return error_info;
39 } 36 }
40 done.Wait(); 37 done.Wait();
41 return error_info; 38 return error_info;
42 } 39 }
43 40
44 void BrowserThreadModelWorker::CallDoWorkAndSignalTask( 41 void BrowserThreadModelWorker::CallDoWorkAndSignalTask(
45 const WorkCallback& work, 42 const WorkCallback& work,
46 WaitableEvent* done, 43 WaitableEvent* done,
(...skipping 25 matching lines...) Expand all
72 FileModelWorker::~FileModelWorker() {} 69 FileModelWorker::~FileModelWorker() {}
73 70
74 void FileModelWorker::CallDoWorkAndSignalTask( 71 void FileModelWorker::CallDoWorkAndSignalTask(
75 const WorkCallback& work, 72 const WorkCallback& work,
76 WaitableEvent* done, 73 WaitableEvent* done,
77 UnrecoverableErrorInfo* error_info) { 74 UnrecoverableErrorInfo* error_info) {
78 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error_info); 75 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error_info);
79 } 76 }
80 77
81 } // namespace browser_sync 78 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/autofill_data_type_controller.cc ('k') | chrome/browser/sync/glue/http_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698