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

Unified Diff: sync/engine/non_blocking_type_commit_contribution.h

Issue 299963002: sync: Implement NonBlockingTypeProcessorCore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/non_blocking_type_commit_contribution.h
diff --git a/sync/engine/non_blocking_type_commit_contribution.h b/sync/engine/non_blocking_type_commit_contribution.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2b19cd7bad71eb440cede002248f808dce6b9a4
--- /dev/null
+++ b/sync/engine/non_blocking_type_commit_contribution.h
@@ -0,0 +1,62 @@
+#ifndef SYNC_ENGINE_NON_BLOCKING_TYPE_COMMIT_CONTRIBUTION_H_
+#define SYNC_ENGINE_NON_BLOCKING_TYPE_COMMIT_CONTRIBUTION_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "sync/engine/commit_contribution.h"
+#include "sync/protocol/sync.pb.h"
+
+namespace syncer {
+
+class NonBlockingTypeProcessorCore;
+
+// A non-blocking sync type's contribution to an outgoing commit message.
+//
+// Helps build a commit message and process its response. It collaborates
+// closely with the NonBlockingTypeProcessorCore.
+class NonBlockingTypeCommitContribution : public CommitContribution {
+ public:
+ NonBlockingTypeCommitContribution(
+ NonBlockingTypeProcessorCore* parent,
Nicolas Zea 2014/05/28 23:56:15 Parent is a pretty overloaded/ambiguous term. How
rlarocque 2014/05/29 20:54:52 I went with processor_core_ to match the class nam
+ const sync_pb::DataTypeContext& context,
+ const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities,
Nicolas Zea 2014/05/28 23:56:15 I wonder if it's worth passing this as vector of s
rlarocque 2014/05/29 20:54:52 I'm on the fence about this. We have to balance t
+ const std::vector<int64> sequence_numbers);
+ virtual ~NonBlockingTypeCommitContribution();
+
+ // Implementation of CommitContribution
+ virtual void AddToCommitMessage(sync_pb::ClientToServerMessage* msg) OVERRIDE;
+ virtual SyncerError ProcessCommitResponse(
+ const sync_pb::ClientToServerResponse& response,
+ sessions::StatusController* status) OVERRIDE;
+ virtual void CleanUp() OVERRIDE;
+ virtual size_t GetNumEntries() const OVERRIDE;
+
+ private:
+ // A non-owned pointer back to the object that created this contribution.
+ NonBlockingTypeProcessorCore* parent_;
Nicolas Zea 2014/05/28 23:56:15 make a const pointer?
rlarocque 2014/05/29 20:54:52 Done. It could even be a reference, since it's gu
+
+ // The type-global context inforamtion.
Nicolas Zea 2014/05/28 23:56:15 nit: information
rlarocque 2014/05/29 20:54:52 Done.
+ sync_pb::DataTypeContext context_;
Nicolas Zea 2014/05/28 23:56:15 make const?
rlarocque 2014/05/29 20:54:52 Done.
+
+ // The set of entities to be committed, serialized as SyncEntities.
+ const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity> entities_;
+
+ // The sequence numbers associated with the pending commits. These match up
+ // with the entities_ vector.
+ const std::vector<int64> sequence_numbers_;
+
+ // The index in the commit message where this contribution's entities are
+ // added. Used to correlate per-item requests with per-item responses.
+ size_t entries_start_index_;
+
+ // A flag used to ensure this object's contract is respected. Helps to check
+ // that CleanUp() is called before the object is destructed.
+ bool cleaned_up_;
+
+ DISALLOW_COPY_AND_ASSIGN(NonBlockingTypeCommitContribution);
+};
+
+} // namespace syncer
+
+#endif // SYNC_ENGINE_NON_BLOCKING_TYPE_COMMIT_CONTRIBUTION_H_

Powered by Google App Engine
This is Rietveld 408576698