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

Side by Side Diff: sync/syncable/parent_child_index.h

Issue 2084243004: [WIP][tracing] Add memory dump provider for sync Directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add visitors for memory. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_ 5 #ifndef SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_
6 #define SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_ 6 #define SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // node has no children or the Id does not identify a valid directory node. 53 // node has no children or the Id does not identify a valid directory node.
54 const OrderedChildSet* GetChildren(const Id& id) const; 54 const OrderedChildSet* GetChildren(const Id& id) const;
55 55
56 // Returns all children of the entry. Returns NULL if the node has no 56 // Returns all children of the entry. Returns NULL if the node has no
57 // children. 57 // children.
58 const OrderedChildSet* GetChildren(EntryKernel* e) const; 58 const OrderedChildSet* GetChildren(EntryKernel* e) const;
59 59
60 // Returns all siblings of the entry. 60 // Returns all siblings of the entry.
61 const OrderedChildSet* GetSiblings(EntryKernel* e) const; 61 const OrderedChildSet* GetSiblings(EntryKernel* e) const;
62 62
63 // Returns the memory usage of the index.
64 size_t bytes_used() const { return bytes_used_; }
65
63 private: 66 private:
64 friend class ParentChildIndexTest; 67 friend class ParentChildIndexTest;
65 68
66 typedef std::map<Id, OrderedChildSet*> ParentChildrenMap; 69 typedef std::map<Id, OrderedChildSet*> ParentChildrenMap;
67 typedef std::vector<Id> TypeRootIds; 70 typedef std::vector<Id> TypeRootIds;
68 typedef ScopedVector<OrderedChildSet> TypeRootChildSets; 71 typedef ScopedVector<OrderedChildSet> TypeRootChildSets;
69 72
70 static bool ShouldUseParentId(const Id& parent_id, ModelType model_type); 73 static bool ShouldUseParentId(const Id& parent_id, ModelType model_type);
71 74
72 // Returns OrderedChildSet that should contain the specified entry 75 // Returns OrderedChildSet that should contain the specified entry
(...skipping 15 matching lines...) Expand all
88 ParentChildrenMap parent_children_map_; 91 ParentChildrenMap parent_children_map_;
89 92
90 // This array tracks model type roots IDs. 93 // This array tracks model type roots IDs.
91 TypeRootIds model_type_root_ids_; 94 TypeRootIds model_type_root_ids_;
92 95
93 // This array contains pre-defined child sets for 96 // This array contains pre-defined child sets for
94 // non-hierarchical types (types with flat hierarchy) that support entries 97 // non-hierarchical types (types with flat hierarchy) that support entries
95 // with implicit parent. 98 // with implicit parent.
96 TypeRootChildSets type_root_child_sets_; 99 TypeRootChildSets type_root_child_sets_;
97 100
101 // Stores the current memory usage of the objects.
102 size_t bytes_used_;
103
98 DISALLOW_COPY_AND_ASSIGN(ParentChildIndex); 104 DISALLOW_COPY_AND_ASSIGN(ParentChildIndex);
99 }; 105 };
100 106
101 } // namespace syncable 107 } // namespace syncable
102 } // namespace syncer 108 } // namespace syncer
103 109
104 #endif // SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_ 110 #endif // SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698