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

Side by Side Diff: components/history/core/browser/history_model_worker.h

Issue 2782573002: [Sync] Refactor ModelSafeWorker::DoWorkAndWaitUntilDone() to avoid code duplication. (Closed)
Patch Set: fix-test-error Created 3 years, 8 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
OLDNEW
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
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
39 private: 35 private:
40 ~HistoryModelWorker() override; 36 ~HistoryModelWorker() override;
41 37
38 void ScheduleWork(base::Closure work) override;
skym 2017/04/06 00:34:54 In the past we've been passing base::Callbacks to
fdoray 2017/04/06 18:10:55 Closure is a simple class that holds a reference t
39
42 const base::WeakPtr<history::HistoryService> history_service_; 40 const base::WeakPtr<history::HistoryService> history_service_;
43 41
44 // A reference to the UI thread's task runner. 42 // A reference to the UI thread's task runner.
45 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; 43 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
46 44
47 // Helper object to make sure we don't leave tasks running on the history 45 // Helper object to make sure we don't leave tasks running on the history
48 // thread. 46 // thread.
49 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_; 47 std::unique_ptr<base::CancelableTaskTracker> cancelable_tracker_;
50 48
51 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker); 49 DISALLOW_COPY_AND_ASSIGN(HistoryModelWorker);
52 }; 50 };
53 51
54 } // namespace browser_sync 52 } // namespace browser_sync
55 53
56 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_ 54 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_MODEL_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698