| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROWSER_THREAD_MODEL_WORKER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.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 "components/sync/base/scoped_event_signal.h" |
| 11 #include "components/sync/base/syncer_error.h" | 12 #include "components/sync/base/syncer_error.h" |
| 12 #include "components/sync/engine/model_safe_worker.h" | 13 #include "components/sync/engine/model_safe_worker.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 16 class WaitableEvent; | 17 class WaitableEvent; |
| 17 } // namespace base | 18 } // namespace base |
| 18 | 19 |
| 19 namespace syncer { | 20 namespace syncer { |
| 20 | 21 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 // ModelSafeWorker implementation. Called on the sync thread. | 33 // ModelSafeWorker implementation. Called on the sync thread. |
| 33 void RegisterForLoopDestruction() override; | 34 void RegisterForLoopDestruction() override; |
| 34 ModelSafeGroup GetModelSafeGroup() override; | 35 ModelSafeGroup GetModelSafeGroup() override; |
| 35 | 36 |
| 36 protected: | 37 protected: |
| 37 ~BrowserThreadModelWorker() override; | 38 ~BrowserThreadModelWorker() override; |
| 38 | 39 |
| 39 SyncerError DoWorkAndWaitUntilDoneImpl(const WorkCallback& work) override; | 40 SyncerError DoWorkAndWaitUntilDoneImpl(const WorkCallback& work) override; |
| 40 | 41 |
| 41 // Marked pure virtual so subclasses have to override, but there is | 42 void CallDoWorkAndSignalTask(const WorkCallback& work, |
| 42 // an implementation that subclasses should use. This is so that | 43 syncer::ScopedEventSignal scoped_event_signal, |
| 43 // (subclass)::CallDoWorkAndSignalTask shows up in callstacks. | 44 SyncerError* error); |
| 44 virtual void CallDoWorkAndSignalTask(const WorkCallback& work, | |
| 45 base::WaitableEvent* done, | |
| 46 SyncerError* error); | |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 scoped_refptr<base::SingleThreadTaskRunner> runner_; | 47 scoped_refptr<base::SingleThreadTaskRunner> runner_; |
| 50 ModelSafeGroup group_; | 48 ModelSafeGroup group_; |
| 51 | 49 |
| 52 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); | 50 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 } // namespace syncer | 53 } // namespace syncer |
| 56 | 54 |
| 57 #endif // COMPONENTS_SYNC_DRIVER_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ | 55 #endif // COMPONENTS_SYNC_DRIVER_GLUE_BROWSER_THREAD_MODEL_WORKER_H_ |
| OLD | NEW |