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

Side by Side Diff: sync/internal_api/public/engine/model_safe_worker.h

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh Created 7 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 | Annotate | Revision Log
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 SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // only knows how to do one thing, and that is take some work (in a fully 59 // only knows how to do one thing, and that is take some work (in a fully
60 // pre-bound callback) and have it performed (as in Run()) from a thread which 60 // pre-bound callback) and have it performed (as in Run()) from a thread which
61 // is guaranteed to be "model-safe", where "safe" refers to not allowing us to 61 // is guaranteed to be "model-safe", where "safe" refers to not allowing us to
62 // cause an embedding application model to fall out of sync with the 62 // cause an embedding application model to fall out of sync with the
63 // syncable::Directory due to a race. Each ModelSafeWorker is affiliated with 63 // syncable::Directory due to a race. Each ModelSafeWorker is affiliated with
64 // a thread and does actual work on that thread. On the destruction of that 64 // a thread and does actual work on that thread. On the destruction of that
65 // thread, the affiliated worker is effectively disabled to do more 65 // thread, the affiliated worker is effectively disabled to do more
66 // work and will notify its observer. 66 // work and will notify its observer.
67 class SYNC_EXPORT ModelSafeWorker 67 class SYNC_EXPORT ModelSafeWorker
68 : public base::RefCountedThreadSafe<ModelSafeWorker>, 68 : public base::RefCountedThreadSafe<ModelSafeWorker>,
69 public MessageLoop::DestructionObserver { 69 public base::MessageLoop::DestructionObserver {
70 public: 70 public:
71 // Subclass should implement to observe destruction of the loop where 71 // Subclass should implement to observe destruction of the loop where
72 // it actually does work. 72 // it actually does work.
73 virtual void RegisterForLoopDestruction() = 0; 73 virtual void RegisterForLoopDestruction() = 0;
74 74
75 // If not stopped, call DoWorkAndWaitUntilDoneImpl() to do work. Otherwise 75 // If not stopped, call DoWorkAndWaitUntilDoneImpl() to do work. Otherwise
76 // return CANNOT_DO_WORK. 76 // return CANNOT_DO_WORK.
77 SyncerError DoWorkAndWaitUntilDone(const WorkCallback& work); 77 SyncerError DoWorkAndWaitUntilDone(const WorkCallback& work);
78 78
79 // Soft stop worker by setting stopped_ flag. Called when sync is disabled 79 // Soft stop worker by setting stopped_ flag. Called when sync is disabled
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( 139 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes(
140 const ModelSafeRoutingInfo& routing_info); 140 const ModelSafeRoutingInfo& routing_info);
141 141
142 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( 142 SYNC_EXPORT ModelSafeGroup GetGroupForModelType(
143 const ModelType type, 143 const ModelType type,
144 const ModelSafeRoutingInfo& routes); 144 const ModelSafeRoutingInfo& routes);
145 145
146 } // namespace syncer 146 } // namespace syncer
147 147
148 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ 148 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_
OLDNEW
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/test/accounts_client/test_accounts_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698