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

Unified Diff: sync/engine/commit_contribution.h

Issue 161253002: sync: Add interfaces for per-type sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another win compile fix Created 6 years, 10 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
« no previous file with comments | « sync/engine/commit.cc ('k') | sync/engine/commit_contribution.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/commit_contribution.h
diff --git a/sync/engine/commit_contribution.h b/sync/engine/commit_contribution.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2e910890744eea51ad7115b18b5109687c69528
--- /dev/null
+++ b/sync/engine/commit_contribution.h
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_ENGINE_COMMIT_CONTRIBUTION_H_
+#define SYNC_ENGINE_COMMIT_CONTRIBUTION_H_
+
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/util/syncer_error.h"
+#include "sync/protocol/sync.pb.h"
+#include "sync/sessions/status_controller.h"
+
+namespace syncer {
+
+namespace sessions {
+class StatusController;
+} // namespace sessions
+
+// This class represents a set of items belonging to a particular data type that
+// have been selected from a CommitContributor and prepared for commit.
+//
+// This class handles the bookkeeping related to the commit of these items.
+class SYNC_EXPORT_PRIVATE CommitContribution {
+ public:
+ CommitContribution();
+ virtual ~CommitContribution() = 0;
+
+ // Serialize this contribution's entries to the given commit request |msg|.
+ //
+ // This function is not const. It may update some state in this contribution
+ // that will be used when processing the associated commit response. This
+ // function should not be called more than once.
+ virtual void AddToCommitMessage(sync_pb::ClientToServerMessage* msg) = 0;
+
+ // Updates this contribution's contents in accordance with the provided
+ // |response|.
+ //
+ // It is not valid to call this function unless AddToCommitMessage() was
+ // called earlier. This function should not be called more than once.
+ virtual SyncerError ProcessCommitResponse(
+ const sync_pb::ClientToServerResponse& response,
+ sessions::StatusController* status) = 0;
+
+ // Cleans up any temproary state associated with the commit. Must be called
+ // before destruction.
+ virtual void CleanUp() = 0;
+
+ // Returns the number of entries included in this contribution.
+ virtual size_t GetNumEntries() const = 0;
+};
+
+} // namespace syncer
+
+#endif // SYNC_ENGINE_COMMIT_CONTRIBUTION_H_
« no previous file with comments | « sync/engine/commit.cc ('k') | sync/engine/commit_contribution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698