| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/sync/engine/model_safe_worker.h" | 9 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 10 #include "chrome/browser/sync/util/unrecoverable_error_info.h" | |
| 11 | 10 |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 16 #include "chrome/browser/cancelable_request.h" | 15 #include "chrome/browser/cancelable_request.h" |
| 17 | 16 |
| 18 class HistoryService; | 17 class HistoryService; |
| 19 | 18 |
| 20 namespace browser_sync { | 19 namespace browser_sync { |
| 21 | 20 |
| 22 // A ModelSafeWorker for history models that accepts requests | 21 // A ModelSafeWorker for history models that accepts requests |
| 23 // from the syncapi that need to be fulfilled on the history thread. | 22 // from the syncapi that need to be fulfilled on the history thread. |
| 24 class HistoryModelWorker : public browser_sync::ModelSafeWorker { | 23 class HistoryModelWorker : public browser_sync::ModelSafeWorker { |
| 25 public: | 24 public: |
| 26 explicit HistoryModelWorker(HistoryService* history_service); | 25 explicit HistoryModelWorker(HistoryService* history_service); |
| 27 virtual ~HistoryModelWorker(); | 26 virtual ~HistoryModelWorker(); |
| 28 | 27 |
| 29 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 28 // ModelSafeWorker implementation. Called on syncapi SyncerThread. |
| 30 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( | 29 virtual SyncerError DoWorkAndWaitUntilDone( |
| 31 const WorkCallback& work) OVERRIDE; | 30 const WorkCallback& work) OVERRIDE; |
| 32 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; | 31 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 scoped_refptr<HistoryService> history_service_; | 34 scoped_refptr<HistoryService> history_service_; |
| 36 // Helper object to make sure we don't leave tasks running on the history | 35 // Helper object to make sure we don't leave tasks running on the history |
| 37 // thread. | 36 // thread. |
| 38 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 37 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
| 39 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); | 38 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 } // namespace browser_sync | 41 } // namespace browser_sync |
| 43 | 42 |
| 44 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ | 43 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ |
| OLD | NEW |