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 COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ |
6 #define COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/synchronization/condition_variable.h" | 12 #include "base/synchronization/condition_variable.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "components/sync/base/unrecoverable_error_info.h" | 14 #include "components/sync/base/unrecoverable_error_info.h" |
15 #include "components/sync/engine/model_safe_worker.h" | 15 #include "components/sync/engine/model_safe_worker.h" |
16 | 16 |
17 namespace syncer { | 17 namespace browser_sync { |
18 | 18 |
19 // A ModelSafeWorker for UI models (e.g. bookmarks) that | 19 // A syncer::ModelSafeWorker for UI models (e.g. bookmarks) that |
20 // accepts work requests from the syncapi that need to be fulfilled | 20 // accepts work requests from the syncapi that need to be fulfilled |
21 // from the MessageLoop home to the native model. | 21 // from the MessageLoop home to the native model. |
22 class UIModelWorker : public ModelSafeWorker { | 22 class UIModelWorker : public syncer::ModelSafeWorker { |
23 public: | 23 public: |
24 UIModelWorker(const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 24 UIModelWorker(const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
25 WorkerLoopDestructionObserver* observer); | 25 syncer::WorkerLoopDestructionObserver* observer); |
26 | 26 |
27 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 27 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. |
28 void RegisterForLoopDestruction() override; | 28 void RegisterForLoopDestruction() override; |
29 ModelSafeGroup GetModelSafeGroup() override; | 29 syncer::ModelSafeGroup GetModelSafeGroup() override; |
30 | 30 |
31 protected: | 31 protected: |
32 SyncerError DoWorkAndWaitUntilDoneImpl(const WorkCallback& work) override; | 32 syncer::SyncerError DoWorkAndWaitUntilDoneImpl( |
| 33 const syncer::WorkCallback& work) override; |
33 | 34 |
34 private: | 35 private: |
35 ~UIModelWorker() override; | 36 ~UIModelWorker() override; |
36 | 37 |
37 // A reference to the UI thread's task runner. | 38 // A reference to the UI thread's task runner. |
38 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 39 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
39 | 40 |
40 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); | 41 DISALLOW_COPY_AND_ASSIGN(UIModelWorker); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace syncer | 44 } // namespace browser_sync |
44 | 45 |
45 #endif // COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ | 46 #endif // COMPONENTS_SYNC_DRIVER_GLUE_UI_MODEL_WORKER_H_ |
OLD | NEW |