OLD | NEW |
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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // syncapi that need to be fulfilled on a browser thread, for example | 22 // syncapi that need to be fulfilled on a browser thread, for example |
23 // autofill on the DB thread. | 23 // 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 syncer::ModelSafeWorker { | 25 class BrowserThreadModelWorker : public syncer::ModelSafeWorker { |
26 public: | 26 public: |
27 BrowserThreadModelWorker(content::BrowserThread::ID thread, | 27 BrowserThreadModelWorker(content::BrowserThread::ID thread, |
28 syncer::ModelSafeGroup group, | 28 syncer::ModelSafeGroup group, |
29 syncer::WorkerLoopDestructionObserver* observer); | 29 syncer::WorkerLoopDestructionObserver* observer); |
30 | 30 |
31 // syncer::ModelSafeWorker implementation. Called on the sync thread. | 31 // syncer::ModelSafeWorker implementation. Called on the sync thread. |
32 virtual void RegisterForLoopDestruction() OVERRIDE; | 32 virtual void RegisterForLoopDestruction() override; |
33 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE; | 33 virtual syncer::ModelSafeGroup GetModelSafeGroup() override; |
34 | 34 |
35 protected: | 35 protected: |
36 virtual ~BrowserThreadModelWorker(); | 36 virtual ~BrowserThreadModelWorker(); |
37 | 37 |
38 virtual syncer::SyncerError DoWorkAndWaitUntilDoneImpl( | 38 virtual syncer::SyncerError DoWorkAndWaitUntilDoneImpl( |
39 const syncer::WorkCallback& work) OVERRIDE; | 39 const syncer::WorkCallback& work) override; |
40 | 40 |
41 // Marked pure virtual so subclasses have to override, but there is | 41 // Marked pure virtual so subclasses have to override, but there is |
42 // an implementation that subclasses should use. This is so that | 42 // an implementation that subclasses should use. This is so that |
43 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. | 43 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. |
44 virtual void CallDoWorkAndSignalTask( | 44 virtual void CallDoWorkAndSignalTask( |
45 const syncer::WorkCallback& work, | 45 const syncer::WorkCallback& work, |
46 base::WaitableEvent* done, | 46 base::WaitableEvent* done, |
47 syncer::SyncerError* error) = 0; | 47 syncer::SyncerError* error) = 0; |
48 | 48 |
49 private: | 49 private: |
50 content::BrowserThread::ID thread_; | 50 content::BrowserThread::ID thread_; |
51 syncer::ModelSafeGroup group_; | 51 syncer::ModelSafeGroup group_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); | 53 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); |
54 }; | 54 }; |
55 | 55 |
56 // Subclass BrowserThreadModelWorker so that we can distinguish them | 56 // Subclass BrowserThreadModelWorker so that we can distinguish them |
57 // from stack traces alone. | 57 // from stack traces alone. |
58 | 58 |
59 class DatabaseModelWorker : public BrowserThreadModelWorker { | 59 class DatabaseModelWorker : public BrowserThreadModelWorker { |
60 public: | 60 public: |
61 explicit DatabaseModelWorker(syncer::WorkerLoopDestructionObserver* observer); | 61 explicit DatabaseModelWorker(syncer::WorkerLoopDestructionObserver* observer); |
62 | 62 |
63 protected: | 63 protected: |
64 virtual void CallDoWorkAndSignalTask( | 64 virtual void CallDoWorkAndSignalTask( |
65 const syncer::WorkCallback& work, | 65 const syncer::WorkCallback& work, |
66 base::WaitableEvent* done, | 66 base::WaitableEvent* done, |
67 syncer::SyncerError* error) OVERRIDE; | 67 syncer::SyncerError* error) override; |
68 | 68 |
69 private: | 69 private: |
70 virtual ~DatabaseModelWorker(); | 70 virtual ~DatabaseModelWorker(); |
71 }; | 71 }; |
72 | 72 |
73 class FileModelWorker : public BrowserThreadModelWorker { | 73 class FileModelWorker : public BrowserThreadModelWorker { |
74 public: | 74 public: |
75 explicit FileModelWorker(syncer::WorkerLoopDestructionObserver* observer); | 75 explicit FileModelWorker(syncer::WorkerLoopDestructionObserver* observer); |
76 | 76 |
77 protected: | 77 protected: |
78 virtual void CallDoWorkAndSignalTask( | 78 virtual void CallDoWorkAndSignalTask( |
79 const syncer::WorkCallback& work, | 79 const syncer::WorkCallback& work, |
80 base::WaitableEvent* done, | 80 base::WaitableEvent* done, |
81 syncer::SyncerError* error) OVERRIDE; | 81 syncer::SyncerError* error) override; |
82 | 82 |
83 private: | 83 private: |
84 virtual ~FileModelWorker(); | 84 virtual ~FileModelWorker(); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace browser_sync | 87 } // namespace browser_sync |
88 | 88 |
89 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ | 89 #endif // CHROME_BROWSER_SYNC_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ |
OLD | NEW |