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

Unified Diff: sync/syncable/parent_child_index.h

Issue 1226213002: Sync: Support nodes with implicit permanent folders: Node Browser and out-of-order loading from DB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed comments Created 5 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 | « sync/syncable/model_type.cc ('k') | 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 84c0771403e566642e6065962f463bb0d9cde16a..6a3145e39ae85f5c0f2fc11ad641356c8393bd88 100644
--- a/sync/syncable/parent_child_index.h
+++ b/sync/syncable/parent_child_index.h
@@ -9,6 +9,7 @@
#include <set>
#include "base/basictypes.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"
@@ -60,14 +61,23 @@ class SYNC_EXPORT_PRIVATE ParentChildIndex {
private:
friend class ParentChildIndexTest;
+
typedef std::map<Id, OrderedChildSet*> ParentChildrenMap;
+ typedef std::vector<Id> TypeRootIds;
+ typedef ScopedVector<OrderedChildSet> TypeRootChildSets;
+
+ static bool ShouldUseParentId(const Id& parent_id, ModelType model_type);
- // Determines entry's model type.
- static ModelType GetModelType(EntryKernel* e);
+ // Returns OrderedChildSet that should contain the specified entry
+ // based on the entry's Parent ID or model type.
+ const OrderedChildSet* GetChildSet(EntryKernel* e) const;
- // Returns parent ID for the entry which is either its PARENT_ID value
- // or derived from its model type.
- const Id& GetParentId(EntryKernel* e) const;
+ // Returns OrderedChildSet that contain entries of the |model_type| type.
+ const OrderedChildSet* 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);
// Returns previously cached model type root ID for the given |model_type|.
const Id& GetModelTypeRootId(ModelType model_type) const;
@@ -77,7 +87,12 @@ class SYNC_EXPORT_PRIVATE ParentChildIndex {
ParentChildrenMap parent_children_map_;
// This array tracks model type roots IDs.
- Id model_type_root_ids_[MODEL_TYPE_COUNT];
+ TypeRootIds model_type_root_ids_;
+
+ // This array contains pre-defined child sets for
+ // non-hierarchical types (types with flat hierarchy) that support entries
+ // with implicit parent.
+ TypeRootChildSets type_root_child_sets_;
DISALLOW_COPY_AND_ASSIGN(ParentChildIndex);
};
« no previous file with comments | « sync/syncable/model_type.cc ('k') | sync/syncable/parent_child_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698