| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ |
| 7 | 7 |
| 8 #include "sync/internal_api/public/engine/model_safe_worker.h" | 8 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // A syncer::ModelSafeWorker for history models that accepts requests | 23 // A syncer::ModelSafeWorker for history models that accepts requests |
| 24 // from the syncapi that need to be fulfilled on the history thread. | 24 // from the syncapi that need to be fulfilled on the history thread. |
| 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<HistoryService>& history_service, | 28 const base::WeakPtr<HistoryService>& history_service, |
| 29 syncer::WorkerLoopDestructionObserver* observer); | 29 syncer::WorkerLoopDestructionObserver* observer); |
| 30 | 30 |
| 31 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. | 31 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. |
| 32 virtual void RegisterForLoopDestruction() OVERRIDE; | 32 virtual void RegisterForLoopDestruction() override; |
| 33 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE; | 33 virtual syncer::ModelSafeGroup GetModelSafeGroup() override; |
| 34 | 34 |
| 35 // Called on history DB thread to register HistoryModelWorker to observe | 35 // Called on history DB thread to register HistoryModelWorker to observe |
| 36 // destruction of history backend loop. | 36 // destruction of history backend loop. |
| 37 void RegisterOnDBThread(); | 37 void RegisterOnDBThread(); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual syncer::SyncerError DoWorkAndWaitUntilDoneImpl( | 40 virtual syncer::SyncerError DoWorkAndWaitUntilDoneImpl( |
| 41 const syncer::WorkCallback& work) OVERRIDE; | 41 const syncer::WorkCallback& work) override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 virtual ~HistoryModelWorker(); | 44 virtual ~HistoryModelWorker(); |
| 45 | 45 |
| 46 const base::WeakPtr<HistoryService> history_service_; | 46 const base::WeakPtr<HistoryService> history_service_; |
| 47 // 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 |
| 48 // thread. | 48 // thread. |
| 49 scoped_ptr<base::CancelableTaskTracker> cancelable_tracker_; | 49 scoped_ptr<base::CancelableTaskTracker> cancelable_tracker_; |
| 50 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); | 50 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace browser_sync | 53 } // namespace browser_sync |
| 54 | 54 |
| 55 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ | 55 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ |
| OLD | NEW |