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

Unified Diff: sync/engine/build_commit_command.h

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor loop again, add comments + more Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/build_commit_command.h
diff --git a/sync/engine/build_commit_command.h b/sync/engine/build_commit_command.h
index d18c94b8f1a84da8a30dabcfe2e5efa025592a8c..7e6c91628e3de01ee5fa80ec4826a0384bdb932c 100644
--- a/sync/engine/build_commit_command.h
+++ b/sync/engine/build_commit_command.h
@@ -14,9 +14,35 @@
namespace browser_sync {
+namespace sessions {
+class OrderedCommitSet;
+}
+
+// A class that contains the code used to serialize a set of sync items into a
+// protobuf commit message. This conversion process references the
+// syncable::Directory, which is why it must be called within the same
+// transaction as the GetCommitIdsCommand that fetched the set of items to be
+// committed.
+//
+// This class, like all SyncerCommands, has a lot more in common with a function
+// than a class. It expects to be instantiated, have its ExecuteImpl() function
+// called, then be destroyed.
class BuildCommitCommand : public SyncerCommand {
public:
- BuildCommitCommand();
+ // Because it must conform to the interface defined in SyncerCommand, this
+ // class's ExecuteImpl() function can't receive input parameters or output any
+ // return values other than a SyncerError. To work around this limitation, we
+ // pass in parameters to the constructor and save them for use when
+ // ExecuteImpl() is eventually called. There will be one ExecuteImpl() call
+ // per instantiation.
+ //
+ // The batch_commit_set parameter contains a set of references to the items
+ // that should be committed.
+ //
+ // The commit_message parameter is an output parameter which will contain the
+ // fully initialized commit message once ExecuteImpl() has been called.
+ BuildCommitCommand(const sessions::OrderedCommitSet& batch_commit_set,
+ ClientToServerMessage* commit_message);
virtual ~BuildCommitCommand();
// SyncerCommand implementation.
@@ -44,6 +70,12 @@ class BuildCommitCommand : public SyncerCommand {
int64 InterpolatePosition(int64 lo, int64 hi);
DISALLOW_COPY_AND_ASSIGN(BuildCommitCommand);
+
+ // Input parameter; see constructor comment.
+ const sessions::OrderedCommitSet& batch_commit_set_;
+
+ // Output parameter; see constructor comment.
+ ClientToServerMessage* commit_message_;
};
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698