| 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 WorkerObserver* observer); |
| 26 | 27 |
| 27 // ModelSafeWorker implementation. Called on the sync thread. | 28 // ModelSafeWorker implementation. Called on the sync thread. |
| 29 virtual void RegisterForLoopDestruction() OVERRIDE; |
| 30 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |
| 31 |
| 32 protected: |
| 28 virtual SyncerError DoWorkAndWaitUntilDone( | 33 virtual SyncerError DoWorkAndWaitUntilDone( |
| 29 const WorkCallback& work) OVERRIDE; | 34 const WorkCallback& work, |
| 30 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; | 35 base::WaitableEvent* done) OVERRIDE; |
| 31 | 36 |
| 32 private: | 37 private: |
| 33 virtual ~PassiveModelWorker(); | 38 virtual ~PassiveModelWorker(); |
| 34 | 39 |
| 35 const base::MessageLoop* const sync_loop_; | 40 const base::MessageLoop* const sync_loop_; |
| 36 | 41 |
| 37 DISALLOW_COPY_AND_ASSIGN(PassiveModelWorker); | 42 DISALLOW_COPY_AND_ASSIGN(PassiveModelWorker); |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 } // namespace syncer | 45 } // namespace syncer |
| 41 | 46 |
| 42 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ | 47 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_PASSIVE_MODEL_WORKER_H_ |
| OLD | NEW |