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

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

Issue 10071033: RefCounted types should not have public destructors, chrome/browser/ part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation ordering fixes as well Created 8 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
11 using base::WaitableEvent; 11 using base::WaitableEvent;
12 using content::BrowserThread; 12 using content::BrowserThread;
13 13
14 namespace browser_sync { 14 namespace browser_sync {
15 15
16 BrowserThreadModelWorker::BrowserThreadModelWorker( 16 BrowserThreadModelWorker::BrowserThreadModelWorker(
17 BrowserThread::ID thread, ModelSafeGroup group) 17 BrowserThread::ID thread, ModelSafeGroup group)
18 : thread_(thread), group_(group) {} 18 : thread_(thread), group_(group) {
19 19 }
20 BrowserThreadModelWorker::~BrowserThreadModelWorker() {}
21 20
22 SyncerError BrowserThreadModelWorker::DoWorkAndWaitUntilDone( 21 SyncerError BrowserThreadModelWorker::DoWorkAndWaitUntilDone(
23 const WorkCallback& work) { 22 const WorkCallback& work) {
24 SyncerError error = UNSET; 23 SyncerError error = UNSET;
25 if (BrowserThread::CurrentlyOn(thread_)) { 24 if (BrowserThread::CurrentlyOn(thread_)) {
26 DLOG(WARNING) << "Already on thread " << thread_; 25 DLOG(WARNING) << "Already on thread " << thread_;
27 return work.Run(); 26 return work.Run();
28 } 27 }
29 WaitableEvent done(false, false); 28 WaitableEvent done(false, false);
30 if (!BrowserThread::PostTask( 29 if (!BrowserThread::PostTask(
31 thread_, 30 thread_,
32 FROM_HERE, 31 FROM_HERE,
33 base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this, 32 base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this,
34 work, &done, &error))) { 33 work, &done, &error))) {
35 NOTREACHED() << "Failed to post task to thread " << thread_; 34 NOTREACHED() << "Failed to post task to thread " << thread_;
36 return error; 35 return error;
37 } 36 }
38 done.Wait(); 37 done.Wait();
39 return error; 38 return error;
40 } 39 }
41 40
41 ModelSafeGroup BrowserThreadModelWorker::GetModelSafeGroup() {
42 return group_;
43 }
44
45 BrowserThreadModelWorker::~BrowserThreadModelWorker() {}
46
42 void BrowserThreadModelWorker::CallDoWorkAndSignalTask( 47 void BrowserThreadModelWorker::CallDoWorkAndSignalTask(
43 const WorkCallback& work, 48 const WorkCallback& work,
44 WaitableEvent* done, 49 WaitableEvent* done,
45 SyncerError* error) { 50 SyncerError* error) {
46 DCHECK(BrowserThread::CurrentlyOn(thread_)); 51 DCHECK(BrowserThread::CurrentlyOn(thread_));
47 *error = work.Run(); 52 *error = work.Run();
48 done->Signal(); 53 done->Signal();
49 } 54 }
50 55
51 ModelSafeGroup BrowserThreadModelWorker::GetModelSafeGroup() { 56 DatabaseModelWorker::DatabaseModelWorker()
52 return group_; 57 : BrowserThreadModelWorker(BrowserThread::DB, GROUP_DB) {
53 } 58 }
54 59
55 DatabaseModelWorker::DatabaseModelWorker()
56 : BrowserThreadModelWorker(BrowserThread::DB, GROUP_DB) {}
57
58 DatabaseModelWorker::~DatabaseModelWorker() {}
59
60 void DatabaseModelWorker::CallDoWorkAndSignalTask( 60 void DatabaseModelWorker::CallDoWorkAndSignalTask(
61 const WorkCallback& work, 61 const WorkCallback& work,
62 WaitableEvent* done, 62 WaitableEvent* done,
63 SyncerError* error) { 63 SyncerError* error) {
64 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); 64 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error);
65 } 65 }
66 66
67 DatabaseModelWorker::~DatabaseModelWorker() {}
68
67 FileModelWorker::FileModelWorker() 69 FileModelWorker::FileModelWorker()
68 : BrowserThreadModelWorker(BrowserThread::FILE, GROUP_FILE) {} 70 : BrowserThreadModelWorker(BrowserThread::FILE, GROUP_FILE) {
69 71 }
70 FileModelWorker::~FileModelWorker() {}
71 72
72 void FileModelWorker::CallDoWorkAndSignalTask( 73 void FileModelWorker::CallDoWorkAndSignalTask(
73 const WorkCallback& work, 74 const WorkCallback& work,
74 WaitableEvent* done, 75 WaitableEvent* done,
75 SyncerError* error) { 76 SyncerError* error) {
76 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); 77 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error);
77 } 78 }
78 79
80 FileModelWorker::~FileModelWorker() {}
81
79 } // namespace browser_sync 82 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/browser_thread_model_worker.h ('k') | chrome/browser/sync/glue/data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698