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

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

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
7
8 #include "chrome/browser/sync/engine/syncer_command.h"
9
10 namespace browser_sync {
11
12 // An abstract SyncerCommand which dispatches its Execute step to the
13 // model-safe worker thread. Classes derived from ModelChangingSyncerCommand
14 // instead of SyncerCommand must implement ModelChangingExecuteImpl instead of
15 // ExecuteImpl, but otherwise, the contract is the same.
16 //
17 // A command should derive from ModelChangingSyncerCommand instead of
18 // SyncerCommand whenever the operation might change any client-visible
19 // fields on any syncable::Entry. If the operation involves creating a
20 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely
21 // necessary.
22 class ModelChangingSyncerCommand : public SyncerCommand {
23 public:
24 ModelChangingSyncerCommand() : work_session_(NULL) { }
25 virtual ~ModelChangingSyncerCommand() { }
26
27 // SyncerCommand implementation. Sets work_session to session.
28 virtual void ExecuteImpl(SyncerSession* session);
29
30 // wrapper so implementations don't worry about storing work_session
31 void StartChangingModel() {
32 ModelChangingExecuteImpl(work_session_);
33 }
34
35 // Abstract method to be implemented by subclasses.
36 virtual void ModelChangingExecuteImpl(SyncerSession* session) = 0;
37
38 private:
39 // ExecuteImpl is expected to be run by SyncerCommand to set work_session.
40 // StartChangingModel is called to start this command running.
41 // Implementations will implement ModelChangingExecuteImpl and not
42 // worry about storing the session or setting it. They are given work_session.
43 SyncerSession* work_session_;
44
45 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand);
46 };
47
48 } // namespace browser_sync
49
50 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698