| 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 |
| 35 private: | 39 private: |
| 36 ~HistoryModelWorker() override; | 40 ~HistoryModelWorker() override; |
| 37 | 41 |
| 38 void ScheduleWork(base::OnceClosure work) override; | |
| 39 | |
| 40 const base::WeakPtr<history::HistoryService> history_service_; | 42 const base::WeakPtr<history::HistoryService> history_service_; |
| 41 | 43 |
| 42 // A reference to the UI thread's task runner. | 44 // A reference to the UI thread's task runner. |
| 43 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 45 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
| 44 | 46 |
| 45 // Helper object to make sure we don't leave tasks running on the history | 47 // Helper object to make sure we don't leave tasks running on the history |
| 46 // thread. | 48 // thread. |
| 47 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_; | 49 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_; |
| 48 | 50 |
| 49 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); | 51 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // namespace browser_sync | 54 } // namespace browser_sync |
| 53 | 55 |
| 54 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ | 56 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ |
| OLD | NEW |