Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: chrome/browser/sync/glue/history_model_worker.h

Issue 14046031: Worker changes to prepare for lock-free shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/common/cancelable_request.h" 15 #include "chrome/browser/common/cancelable_request.h"
16 #include "chrome/browser/history/history_db_task.h"
16 #include "chrome/browser/history/history_service.h" 17 #include "chrome/browser/history/history_service.h"
17 18
18 class HistoryService; 19 class HistoryService;
19 20
20 namespace browser_sync { 21 namespace browser_sync {
21 22
22 // A syncer::ModelSafeWorker for history models that accepts requests 23 // A syncer::ModelSafeWorker for history models that accepts requests
23 // 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.
24 class HistoryModelWorker : public syncer::ModelSafeWorker { 25 class HistoryModelWorker : public syncer::ModelSafeWorker {
25 public: 26 public:
26 explicit HistoryModelWorker( 27 explicit HistoryModelWorker(
27 const base::WeakPtr<HistoryService>& history_service); 28 const base::WeakPtr<HistoryService>& history_service,
29 syncer::WorkerLoopDestructionObserver* observer);
28 30
29 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread. 31 // syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread.
30 virtual syncer::SyncerError DoWorkAndWaitUntilDone( 32 virtual void RegisterForLoopDestruction() OVERRIDE;
33 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE;
34
35 protected:
36 virtual syncer::SyncerError DoWorkAndWaitUntilDoneImpl(
31 const syncer::WorkCallback& work) OVERRIDE; 37 const syncer::WorkCallback& work) OVERRIDE;
32 virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE;
33 38
34 private: 39 private:
35 virtual ~HistoryModelWorker(); 40 virtual ~HistoryModelWorker();
36 41
37 const base::WeakPtr<HistoryService> history_service_; 42 const base::WeakPtr<HistoryService> history_service_;
38 // Helper object to make sure we don't leave tasks running on the history 43 // Helper object to make sure we don't leave tasks running on the history
39 // thread. 44 // thread.
40 CancelableRequestConsumerT<int, 0> cancelable_consumer_; 45 CancelableRequestConsumerT<int, 0> cancelable_consumer_;
41 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); 46 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker);
42 }; 47 };
43 48
44 } // namespace browser_sync 49 } // namespace browser_sync
45 50
46 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_ 51 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_MODEL_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc ('k') | chrome/browser/sync/glue/history_model_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698