| 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" |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/cancelable_request.h" | 15 #include "content/browser/cancelable_request.h" |
| 15 | 16 |
| 16 class HistoryService; | 17 class HistoryService; |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class WaitableEvent; | 20 class WaitableEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace browser_sync { | 23 namespace browser_sync { |
| 23 | 24 |
| 24 // A ModelSafeWorker for history models that accepts requests | 25 // A ModelSafeWorker for history models that accepts requests |
| 25 // from the syncapi that need to be fulfilled on the history thread. | 26 // from the syncapi that need to be fulfilled on the history thread. |
| 26 class HistoryModelWorker : public browser_sync::ModelSafeWorker { | 27 class HistoryModelWorker : public browser_sync::ModelSafeWorker { |
| 27 public: | 28 public: |
| 28 explicit HistoryModelWorker(HistoryService* history_service); | 29 explicit HistoryModelWorker(HistoryService* history_service); |
| 29 virtual ~HistoryModelWorker(); | 30 virtual ~HistoryModelWorker(); |
| 30 | 31 |
| 31 // ModelSafeWorker implementation. Called on syncapi SyncerThread. | 32 // ModelSafeWorker implementation. Called on syncapi SyncerThread. |
| 32 virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); | 33 virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( |
| 33 virtual ModelSafeGroup GetModelSafeGroup(); | 34 const WorkCallback& work) OVERRIDE; |
| 35 virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 scoped_refptr<HistoryService> history_service_; | 38 scoped_refptr<HistoryService> history_service_; |
| 37 // Helper object to make sure we don't leave tasks running on the history | 39 // Helper object to make sure we don't leave tasks running on the history |
| 38 // thread. | 40 // thread. |
| 39 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 41 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
| 40 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); | 42 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 } // namespace browser_sync | 45 } // namespace browser_sync |
| 44 | 46 |
| 45 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ | 47 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ |
| OLD | NEW |