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

Side by Side Diff: components/sync/engine/model_safe_worker.h

Issue 2942773002: Task Scheduler API migration: change BrowserThreadModelWorker to SequencedModelWorker (Closed)
Patch Set: Created 3 years, 6 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_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
6 #define COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ 6 #define COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // If not stopped, calls ScheduleWork() to schedule |work| and waits until it 59 // If not stopped, calls ScheduleWork() to schedule |work| and waits until it
60 // is done or abandoned. Otherwise, returns CANNOT_DO_WORK. 60 // is done or abandoned. Otherwise, returns CANNOT_DO_WORK.
61 SyncerError DoWorkAndWaitUntilDone(WorkCallback work); 61 SyncerError DoWorkAndWaitUntilDone(WorkCallback work);
62 62
63 // Soft stop worker by setting stopped_ flag. Called when sync is disabled 63 // Soft stop worker by setting stopped_ flag. Called when sync is disabled
64 // or browser is shutting down. Called on UI loop. 64 // or browser is shutting down. Called on UI loop.
65 virtual void RequestStop(); 65 virtual void RequestStop();
66 66
67 virtual ModelSafeGroup GetModelSafeGroup() = 0; 67 virtual ModelSafeGroup GetModelSafeGroup() = 0;
68 68
69 // Returns true if called on the thread this worker works on. 69 // Returns true if called on the sequence this worker works on.
70 virtual bool IsOnModelThread() = 0; 70 virtual bool IsOnModelSequence() = 0;
71 71
72 protected: 72 protected:
73 ModelSafeWorker(); 73 ModelSafeWorker();
74 virtual ~ModelSafeWorker(); 74 virtual ~ModelSafeWorker();
75 75
76 private: 76 private:
77 friend class base::RefCountedThreadSafe<ModelSafeWorker>; 77 friend class base::RefCountedThreadSafe<ModelSafeWorker>;
78 78
79 // Schedules |work| on the appropriate thread. 79 // Schedules |work| on the appropriate thread.
skym 2017/06/16 17:26:52 Should this be updated from "thread" to "sequence"
stanisc 2017/06/19 19:14:04 Done.
80 virtual void ScheduleWork(base::OnceClosure work) = 0; 80 virtual void ScheduleWork(base::OnceClosure work) = 0;
81 81
82 void DoWork(WorkCallback work, 82 void DoWork(WorkCallback work,
83 base::ScopedClosureRunner scoped_closure_runner, 83 base::ScopedClosureRunner scoped_closure_runner,
84 SyncerError* error, 84 SyncerError* error,
85 bool* did_run); 85 bool* did_run);
86 86
87 // Synchronizes access to all members. 87 // Synchronizes access to all members.
88 base::Lock lock_; 88 base::Lock lock_;
89 89
(...skipping 25 matching lines...) Expand all
115 const ModelSafeRoutingInfo& routing_info); 115 const ModelSafeRoutingInfo& routing_info);
116 116
117 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info); 117 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info);
118 118
119 ModelSafeGroup GetGroupForModelType(const ModelType type, 119 ModelSafeGroup GetGroupForModelType(const ModelType type,
120 const ModelSafeRoutingInfo& routes); 120 const ModelSafeRoutingInfo& routes);
121 121
122 } // namespace syncer 122 } // namespace syncer
123 123
124 #endif // COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ 124 #endif // COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698