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

Side by Side Diff: chrome/browser/sync/engine/model_changing_syncer_command.h

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
7 7
8 #include "chrome/browser/sync/engine/syncer_command.h" 8 #include "chrome/browser/sync/engine/syncer_command.h"
9 9
10 namespace browser_sync { 10 namespace browser_sync {
11 namespace sessions {
12 class SyncSession;
13 }
11 14
12 // An abstract SyncerCommand which dispatches its Execute step to the 15 // An abstract SyncerCommand which dispatches its Execute step to the
13 // model-safe worker thread. Classes derived from ModelChangingSyncerCommand 16 // model-safe worker thread. Classes derived from ModelChangingSyncerCommand
14 // instead of SyncerCommand must implement ModelChangingExecuteImpl instead of 17 // instead of SyncerCommand must implement ModelChangingExecuteImpl instead of
15 // ExecuteImpl, but otherwise, the contract is the same. 18 // ExecuteImpl, but otherwise, the contract is the same.
16 // 19 //
17 // A command should derive from ModelChangingSyncerCommand instead of 20 // A command should derive from ModelChangingSyncerCommand instead of
18 // SyncerCommand whenever the operation might change any client-visible 21 // SyncerCommand whenever the operation might change any client-visible
19 // fields on any syncable::Entry. If the operation involves creating a 22 // fields on any syncable::Entry. If the operation involves creating a
20 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely 23 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely
21 // necessary. 24 // necessary.
22 class ModelChangingSyncerCommand : public SyncerCommand { 25 class ModelChangingSyncerCommand : public SyncerCommand {
23 public: 26 public:
24 ModelChangingSyncerCommand() : work_session_(NULL) { } 27 ModelChangingSyncerCommand() : work_session_(NULL) { }
25 virtual ~ModelChangingSyncerCommand() { } 28 virtual ~ModelChangingSyncerCommand() { }
26 29
27 // SyncerCommand implementation. Sets work_session to session. 30 // SyncerCommand implementation. Sets work_session to session.
28 virtual void ExecuteImpl(SyncerSession* session); 31 virtual void ExecuteImpl(sessions::SyncSession* session);
29 32
30 // wrapper so implementations don't worry about storing work_session 33 // wrapper so implementations don't worry about storing work_session
31 void StartChangingModel() { 34 void StartChangingModel() {
32 ModelChangingExecuteImpl(work_session_); 35 ModelChangingExecuteImpl(work_session_);
33 } 36 }
34 37
35 // Abstract method to be implemented by subclasses. 38 // Abstract method to be implemented by subclasses.
36 virtual void ModelChangingExecuteImpl(SyncerSession* session) = 0; 39 virtual void ModelChangingExecuteImpl(sessions::SyncSession* session) = 0;
37 40
38 private: 41 private:
39 // ExecuteImpl is expected to be run by SyncerCommand to set work_session. 42 // ExecuteImpl is expected to be run by SyncerCommand to set work_session.
40 // StartChangingModel is called to start this command running. 43 // StartChangingModel is called to start this command running.
41 // Implementations will implement ModelChangingExecuteImpl and not 44 // Implementations will implement ModelChangingExecuteImpl and not
42 // worry about storing the session or setting it. They are given work_session. 45 // worry about storing the session or setting it. They are given work_session.
43 SyncerSession* work_session_; 46 sessions::SyncSession* work_session_;
44 47
45 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); 48 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand);
46 }; 49 };
47 50
48 } // namespace browser_sync 51 } // namespace browser_sync
49 52
50 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 53 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/get_commit_ids_command.cc ('k') | chrome/browser/sync/engine/model_changing_syncer_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698