| 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_BROWSER_THREAD_MODEL_WORKER_H_ | |
| 6 #define COMPONENTS_SYNC_ENGINE_BROWSER_THREAD_MODEL_WORKER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/single_thread_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 browser thread, for example | |
| 17 // autofill on the DB thread. | |
| 18 // TODO(sync): Try to generalize other ModelWorkers (e.g. history, etc). | |
| 19 class BrowserThreadModelWorker : public ModelSafeWorker { | |
| 20 public: | |
| 21 BrowserThreadModelWorker( | |
| 22 const scoped_refptr<base::SingleThreadTaskRunner>& runner, | |
| 23 ModelSafeGroup group); | |
| 24 | |
| 25 // ModelSafeWorker implementation. | |
| 26 ModelSafeGroup GetModelSafeGroup() override; | |
| 27 bool IsOnModelThread() override; | |
| 28 | |
| 29 private: | |
| 30 ~BrowserThreadModelWorker() override; | |
| 31 | |
| 32 void ScheduleWork(base::OnceClosure work) override; | |
| 33 | |
| 34 scoped_refptr<base::SingleThreadTaskRunner> runner_; | |
| 35 ModelSafeGroup group_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(BrowserThreadModelWorker); | |
| 38 }; | |
| 39 | |
| 40 } // namespace syncer | |
| 41 | |
| 42 #endif // COMPONENTS_SYNC_ENGINE_BROWSER_THREAD_MODEL_WORKER_H_ | |
| OLD | NEW |