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 SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "sync/base/sync_export.h" | 10 #include "sync/base/sync_export.h" |
11 #include "sync/internal_api/public/engine/model_safe_worker.h" | 11 #include "sync/internal_api/public/engine/model_safe_worker.h" |
12 #include "sync/internal_api/public/util/syncer_error.h" | 12 #include "sync/internal_api/public/util/syncer_error.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class MessageLoop; | 15 class MessageLoop; |
16 } | 16 } |
17 | 17 |
18 namespace syncer { | 18 namespace syncer { |
19 | 19 |
20 // Implementation of ModelSafeWorker for passive types. All work is | 20 // Implementation of ModelSafeWorker for passive types. All work is |
21 // done on the same thread DoWorkAndWaitUntilDone (i.e., the sync | 21 // done on the same thread DoWorkAndWaitUntilDone (i.e., the sync |
22 // thread). | 22 // thread). |
23 class SYNC_EXPORT PassiveModelWorker : public ModelSafeWorker { | 23 class SYNC_EXPORT PassiveModelWorker : public ModelSafeWorker { |
24 public: | 24 public: |
25 explicit PassiveModelWorker(const base::MessageLoop* sync_loop); | 25 explicit PassiveModelWorker(const base::MessageLoop* sync_loop, |
| 26 WorkerLoopDestructionObserver* observer); |
26 | 27 |
27 // ModelSafeWorker implementation. Called on the sync thread. | 28 // ModelSafeWorker implementation. Called on the sync thread. |
28 virtual SyncerError DoWorkAndWaitUntilDone( | 29 virtual void RegisterForLoopDestruction() OVERRIDE; |
| 30 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |
| 31 |
| 32 protected: |
| 33 virtual SyncerError DoWorkAndWaitUntilDoneImpl( |
29 const WorkCallback& work) OVERRIDE; | 34 const WorkCallback& work) OVERRIDE; |
30 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; | |
31 | 35 |
32 private: | 36 private: |
33 virtual ~PassiveModelWorker(); | 37 virtual ~PassiveModelWorker(); |
34 | 38 |
35 const base::MessageLoop* const sync_loop_; | 39 const base::MessageLoop* const sync_loop_; |
36 | 40 |
37 DISALLOW_COPY_AND_ASSIGN(PassiveModelWorker); | 41 DISALLOW_COPY_AND_ASSIGN(PassiveModelWorker); |
38 }; | 42 }; |
39 | 43 |
40 } // namespace syncer | 44 } // namespace syncer |
41 | 45 |
42 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ | 46 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ |
OLD | NEW |