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_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class HistoryModelWorker : public syncer::ModelSafeWorker { | 25 class HistoryModelWorker : public syncer::ModelSafeWorker { |
26 public: | 26 public: |
27 explicit HistoryModelWorker( | 27 explicit HistoryModelWorker( |
28 const base::WeakPtr<history::HistoryService>& history_service, | 28 const base::WeakPtr<history::HistoryService>& history_service, |
29 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread); | 29 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread); |
30 | 30 |
31 // syncer::ModelSafeWorker implementation. | 31 // syncer::ModelSafeWorker implementation. |
32 syncer::ModelSafeGroup GetModelSafeGroup() override; | 32 syncer::ModelSafeGroup GetModelSafeGroup() override; |
33 bool IsOnModelThread() override; | 33 bool IsOnModelThread() override; |
34 | 34 |
35 protected: | |
36 syncer::SyncerError DoWorkAndWaitUntilDoneImpl( | |
37 const syncer::WorkCallback& work) override; | |
38 | |
39 private: | 35 private: |
40 ~HistoryModelWorker() override; | 36 ~HistoryModelWorker() override; |
41 | 37 |
| 38 void ScheduleWork(base::OnceClosure work) override; |
| 39 |
42 const base::WeakPtr<history::HistoryService> history_service_; | 40 const base::WeakPtr<history::HistoryService> history_service_; |
43 | 41 |
44 // A reference to the UI thread's task runner. | 42 // A reference to the UI thread's task runner. |
45 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 43 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
46 | 44 |
47 // Helper object to make sure we don't leave tasks running on the history | 45 // Helper object to make sure we don't leave tasks running on the history |
48 // thread. | 46 // thread. |
49 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_; | 47 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_; |
50 | 48 |
51 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); | 49 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); |
52 }; | 50 }; |
53 | 51 |
54 } // namespace browser_sync | 52 } // namespace browser_sync |
55 | 53 |
56 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ | 54 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ |
OLD | NEW |