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

Unified Diff: sync/syncable/parent_child_index.h

Issue 2168273002: [Sync] Fix behavior when there are two type roots for a type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit Created 4 years, 5 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 | « no previous file | sync/syncable/parent_child_index.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/parent_child_index.h
diff --git a/sync/syncable/parent_child_index.h b/sync/syncable/parent_child_index.h
index 540234c62b29e81b16557739a626dad8a7a06e14..0488c044bf9664c9b5f9956d6121364885405ddc 100644
--- a/sync/syncable/parent_child_index.h
+++ b/sync/syncable/parent_child_index.h
@@ -6,11 +6,11 @@
#define SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_
#include <map>
+#include <memory>
#include <set>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_vector.h"
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/syncable/syncable_id.h"
@@ -28,6 +28,7 @@ struct SYNC_EXPORT ChildComparator {
// An ordered set of nodes.
typedef std::set<EntryKernel*, ChildComparator> OrderedChildSet;
+typedef std::shared_ptr<OrderedChildSet> OrderedChildSetRef;
// Container that tracks parent-child relationships.
// Provides fast lookup of all items under a given parent.
@@ -63,22 +64,22 @@ class SYNC_EXPORT ParentChildIndex {
private:
friend class ParentChildIndexTest;
- typedef std::map<Id, OrderedChildSet*> ParentChildrenMap;
+ typedef std::map<Id, OrderedChildSetRef> ParentChildrenMap;
typedef std::vector<Id> TypeRootIds;
- typedef ScopedVector<OrderedChildSet> TypeRootChildSets;
+ typedef std::vector<OrderedChildSetRef> TypeRootChildSets;
static bool ShouldUseParentId(const Id& parent_id, ModelType model_type);
// Returns OrderedChildSet that should contain the specified entry
// based on the entry's Parent ID or model type.
- const OrderedChildSet* GetChildSet(EntryKernel* e) const;
+ const OrderedChildSetRef GetChildSet(EntryKernel* e) const;
// Returns OrderedChildSet that contain entries of the |model_type| type.
- const OrderedChildSet* GetModelTypeChildSet(ModelType model_type) const;
+ const OrderedChildSetRef GetModelTypeChildSet(ModelType model_type) const;
// Returns mutable OrderedChildSet that contain entries of the |model_type|
// type. Create one as necessary.
- OrderedChildSet* GetOrCreateModelTypeChildSet(ModelType model_type);
+ OrderedChildSetRef GetOrCreateModelTypeChildSet(ModelType model_type);
// Returns previously cached model type root ID for the given |model_type|.
const Id& GetModelTypeRootId(ModelType model_type) const;
« no previous file with comments | « no previous file | sync/syncable/parent_child_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698