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

Unified Diff: sync/engine/committer_list.h

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split the type manager Created 7 years 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/committer_list.h
diff --git a/sync/engine/committer_list.h b/sync/engine/committer_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..db338c7167407bbb48b8be4eddd084ebfbab17ba
--- /dev/null
+++ b/sync/engine/committer_list.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2013 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_COMMITTER_LIST_H_
+#define SYNC_ENGINE_COMMITTER_LIST_H_
+
+#include <map>
+#include <vector>
+
+#include "base/stl_util.h"
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/engine/model_safe_worker.h"
+
+namespace syncer {
+
+namespace syncable {
+class Directory;
+} // namespace syncable
+
+class SyncDirectoryCommitContributor;
+class SyncDirectoryCommitContribution;
+
+typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap;
Nicolas Zea 2013/12/18 22:36:10 Do no other places declare this typedef? Does it n
rlarocque 2014/01/03 01:46:41 It could be moved into CommitterList, but I think
+
+// This class manages the set of per-type committer objects.
+//
+// It owns these types and hides the details of iterating over all of them.
+// Many methods allow the caller to specify a subset of types on which the
+// operation is to be applied. It is a logic error if the supplied set of types
+// contains a type which was not previously registered.
+class SYNC_EXPORT_PRIVATE CommitterList {
+ public:
+ CommitterList();
+ ~CommitterList();
+
+ // Builds or rebuilds the set of syncable::Directory sync type objects.
+ void SetEnabledSyncDirectoryTypes(
Nicolas Zea 2013/12/18 22:36:10 Why not just SetEnabledTypes? In the bismarck worl
rlarocque 2014/01/03 01:46:41 I'm thinking it won't have access to that informat
+ const std::vector<scoped_refptr<ModelSafeWorker> > workers,
Nicolas Zea 2013/12/18 22:36:10 const ref
rlarocque 2014/01/03 01:46:41 Removed in the most recent patch.
+ const ModelSafeRoutingInfo& routing_info,
+ syncable::Directory* dir);
+
+ // Gathers a set of contributions to be used to populate a commit message.
+ void GatherCommitContributions(
+ ModelTypeSet commit_types,
+ size_t max_entries,
+ ContributionMap* contributions);
+
+ // Registration a commit contributor directly. Useful in tests.
Nicolas Zea 2013/12/18 22:36:10 Registration -> Register
rlarocque 2014/01/03 01:46:41 Done.
+ void RegisterTypeForTest(
+ ModelType type,
+ SyncDirectoryCommitContributor* contributor);
+
+ private:
+ typedef std::map<ModelType, SyncDirectoryCommitContributor*>
+ CommitContributorMap;
+
+ // A map of 'commit contributors', one for each enabled type.
+ CommitContributorMap commit_contributor_map_;
+
+ // Deleter for the |commit_contributor_map_|.
+ STLValueDeleter<CommitContributorMap> commit_contributor_deleter_;
+};
+
+} // namespace syncer
+
+#endif // SYNC_ENGINE_COMMITTER_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698