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

Unified Diff: sync/engine/commit.h

Issue 25638003: sync: Implement per-type commit interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile warning Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/commit.h
diff --git a/sync/engine/commit.h b/sync/engine/commit.h
index 168d950c276a1242695cb70f476dcc0845c2672b..c5fcc62f19baa1a55c76a228f7eb42c6c706bf9e 100644
--- a/sync/engine/commit.h
+++ b/sync/engine/commit.h
@@ -5,15 +5,31 @@
#ifndef SYNC_ENGINE_COMMIT_H_
#define SYNC_ENGINE_COMMIT_H_
+#include <map>
+
+#include "base/stl_util.h"
+#include "sync/base/sync_export.h"
+#include "sync/engine/sync_directory_commit_contributor.h"
#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/engine/model_safe_worker.h"
#include "sync/internal_api/public/util/syncer_error.h"
+#include "sync/protocol/sync.pb.h"
+#include "sync/util/extensions_activity.h"
+
+namespace sync_pb {
+class ClientToServerMessage;
+class ClientToServerResponse;
+}
namespace syncer {
namespace sessions {
+class StatusController;
class SyncSession;
}
+class SyncDirectoryCommitContribution;
+class SyncDirectoryCommitContributor;
class Syncer;
// This function will commit batches of unsynced items to the server until the
@@ -33,6 +49,46 @@ SyncerError BuildAndPostCommits(
Syncer* syncer,
sessions::SyncSession* session);
+// This class wraps the actions related to building and executing a single
+// commit operation.
+//
+// This class' most important responsibility is to manage the ContributionsMap.
+// This class serves as a container for those objects. Although it would have
+// been acceptable to let this class be a dumb container object, it turns out
+// that there was no other convenient place to put the Init() and
+// PostAndProcessCommitResponse() functions. So they ended up here.
+class SYNC_EXPORT_PRIVATE Commit {
+ public:
+ static Commit* Init(
+ ModelTypeSet requested_types,
+ CommitContributorMap* contributor_map,
+ size_t max_entries,
+ const std::string& account_name,
+ const std::string& cache_guid,
+ ExtensionsActivity* extensions_activity);
+
+ explicit Commit(
+ std::map<ModelType, SyncDirectoryCommitContribution*> contributions,
+ sync_pb::ClientToServerMessage message,
+ ExtensionsActivity::Records extensions_activity_buffer);
+ ~Commit();
+
+ SyncerError PostAndProcessResponse(
+ sessions::SyncSession* session,
+ sessions::StatusController* status,
+ ExtensionsActivity* extensions_activity);
+
+ private:
+ typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap;
+
+ ContributionMap contributions_;
+ STLValueDeleter<ContributionMap> deleter_;
+
+ sync_pb::ClientToServerMessage message_;
+ sync_pb::ClientToServerResponse response_;
+ ExtensionsActivity::Records extensions_activity_buffer_;
+};
+
} // namespace syncer
#endif // SYNC_ENGINE_COMMIT_H_

Powered by Google App Engine
This is Rietveld 408576698