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

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

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 #ifndef CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
6 #define CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "sync/engine/model_safe_worker.h" 13 #include "sync/engine/model_safe_worker.h"
14 #include "sync/util/syncer_error.h" 14 #include "sync/util/syncer_error.h"
15 15
16 namespace base { 16 namespace base {
17 class WaitableEvent; 17 class WaitableEvent;
18 } 18 }
19 19
20 namespace browser_sync { 20 namespace browser_sync {
21 21
22 // A ModelSafeWorker for models that accept requests from the syncapi that need 22 // A ModelSafeWorker for models that accept requests from the syncapi that need
23 // to be fulfilled on a browser thread, for example autofill on the DB thread. 23 // to be fulfilled on a browser thread, for example autofill on the DB thread.
24 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc). 24 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc).
25 class BrowserThreadModelWorker : public ModelSafeWorker { 25 class BrowserThreadModelWorker : public ModelSafeWorker {
26 public: 26 public:
27 BrowserThreadModelWorker(content::BrowserThread::ID thread, 27 BrowserThreadModelWorker(content::BrowserThread::ID thread,
28 ModelSafeGroup group); 28 ModelSafeGroup group);
29 virtual ~BrowserThreadModelWorker();
30 29
31 // ModelSafeWorker implementation. Called on the sync thread. 30 // ModelSafeWorker implementation. Called on the sync thread.
32 virtual SyncerError DoWorkAndWaitUntilDone( 31 virtual SyncerError DoWorkAndWaitUntilDone(
33 const WorkCallback& work) OVERRIDE; 32 const WorkCallback& work) OVERRIDE;
34 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; 33 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE;
35 34
36 protected: 35 protected:
36 virtual ~BrowserThreadModelWorker();
37
37 // Marked pure virtual so subclasses have to override, but there is 38 // Marked pure virtual so subclasses have to override, but there is
38 // an implementation that subclasses should use. This is so that 39 // an implementation that subclasses should use. This is so that
39 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. 40 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks.
40 virtual void CallDoWorkAndSignalTask( 41 virtual void CallDoWorkAndSignalTask(
41 const WorkCallback& work, 42 const WorkCallback& work,
42 base::WaitableEvent* done, 43 base::WaitableEvent* done,
43 SyncerError* error) = 0; 44 SyncerError* error) = 0;
44 45
45 private: 46 private:
46 content::BrowserThread::ID thread_; 47 content::BrowserThread::ID thread_;
47 ModelSafeGroup group_; 48 ModelSafeGroup group_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); 50 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker);
50 }; 51 };
51 52
52 // Subclass BrowserThreadModelWorker so that we can distinguish them 53 // Subclass BrowserThreadModelWorker so that we can distinguish them
53 // from stack traces alone. 54 // from stack traces alone.
54 55
55 class DatabaseModelWorker : public BrowserThreadModelWorker { 56 class DatabaseModelWorker : public BrowserThreadModelWorker {
56 public: 57 public:
57 DatabaseModelWorker(); 58 DatabaseModelWorker();
58 virtual ~DatabaseModelWorker();
59 59
60 protected: 60 protected:
61 virtual void CallDoWorkAndSignalTask( 61 virtual void CallDoWorkAndSignalTask(
62 const WorkCallback& work, 62 const WorkCallback& work,
63 base::WaitableEvent* done, 63 base::WaitableEvent* done,
64 SyncerError* error) OVERRIDE; 64 SyncerError* error) OVERRIDE;
65
66 private:
67 virtual ~DatabaseModelWorker();
65 }; 68 };
66 69
67 class FileModelWorker : public BrowserThreadModelWorker { 70 class FileModelWorker : public BrowserThreadModelWorker {
68 public: 71 public:
69 FileModelWorker(); 72 FileModelWorker();
70 virtual ~FileModelWorker();
71 73
72 protected: 74 protected:
73 virtual void CallDoWorkAndSignalTask( 75 virtual void CallDoWorkAndSignalTask(
74 const WorkCallback& work, 76 const WorkCallback& work,
75 base::WaitableEvent* done, 77 base::WaitableEvent* done,
76 SyncerError* error) OVERRIDE; 78 SyncerError* error) OVERRIDE;
79
80 private:
81 virtual ~FileModelWorker();
77 }; 82 };
78 83
79 } // namespace browser_sync 84 } // namespace browser_sync
80 85
81 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ 86 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698