OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DATABASE_MODEL_WORKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "base/waitable_event.h" | |
12 #include "chrome/browser/sync/engine/model_safe_worker.h" | 11 #include "chrome/browser/sync/engine/model_safe_worker.h" |
13 | 12 |
| 13 namespace base { |
| 14 class WaitableEvent; |
| 15 } |
| 16 |
14 namespace browser_sync { | 17 namespace browser_sync { |
15 | 18 |
16 // A ModelSafeWorker for database models (eg. autofill) that accepts requests | 19 // A ModelSafeWorker for database models (eg. autofill) that accepts requests |
17 // from the syncapi that need to be fulfilled on the database thread. | 20 // from the syncapi that need to be fulfilled on the database thread. |
18 class DatabaseModelWorker : public browser_sync::ModelSafeWorker { | 21 class DatabaseModelWorker : public browser_sync::ModelSafeWorker { |
19 public: | 22 public: |
20 explicit DatabaseModelWorker() {} | 23 explicit DatabaseModelWorker() {} |
21 | 24 |
22 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 25 // ModelSafeWorker implementation. Called on syncapi SyncerThread. |
23 void DoWorkAndWaitUntilDone(Callback0::Type* work); | 26 void DoWorkAndWaitUntilDone(Callback0::Type* work); |
24 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; } | 27 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; } |
25 virtual bool CurrentThreadIsWorkThread(); | 28 virtual bool CurrentThreadIsWorkThread(); |
26 | 29 |
27 private: | 30 private: |
28 void CallDoWorkAndSignalTask(Callback0::Type* work, | 31 void CallDoWorkAndSignalTask(Callback0::Type* work, |
29 base::WaitableEvent* done); | 32 base::WaitableEvent* done); |
30 | 33 |
31 DISALLOW_COPY_AND_ASSIGN(DatabaseModelWorker); | 34 DISALLOW_COPY_AND_ASSIGN(DatabaseModelWorker); |
32 }; | 35 }; |
33 | 36 |
34 } // namespace browser_sync | 37 } // namespace browser_sync |
35 | 38 |
36 #endif // CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ | 39 #endif // CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ |
OLD | NEW |