| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SYNC_ENGINE_SEQUENCED_MODEL_WORKER_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_SEQUENCED_MODEL_WORKER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/sequenced_task_runner.h" |
| 11 #include "components/sync/engine/model_safe_worker.h" |
| 12 |
| 13 namespace syncer { |
| 14 |
| 15 // A ModelSafeWorker for models that accept requests from the |
| 16 // syncapi that need to be fulfilled on a model specific sequenced task runner. |
| 17 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc). |
| 18 class SequencedModelWorker : public ModelSafeWorker { |
| 19 public: |
| 20 SequencedModelWorker(const scoped_refptr<base::SequencedTaskRunner>& runner, |
| 21 ModelSafeGroup group); |
| 22 |
| 23 // ModelSafeWorker implementation. |
| 24 ModelSafeGroup GetModelSafeGroup() override; |
| 25 bool IsOnModelSequence() override; |
| 26 |
| 27 private: |
| 28 ~SequencedModelWorker() override; |
| 29 |
| 30 void ScheduleWork(base::OnceClosure work) override; |
| 31 |
| 32 scoped_refptr<base::SequencedTaskRunner> runner_; |
| 33 ModelSafeGroup group_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(SequencedModelWorker); |
| 36 }; |
| 37 |
| 38 } // namespace syncer |
| 39 |
| 40 #endif // COMPONENTS_SYNC_ENGINE_SEQUENCED_MODEL_WORKER_H_ |
| OLD | NEW |