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

Side by Side Diff: src/heap-snapshot-generator.h

Issue 12943004: Deprecate HeapSnapshot type (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/heap-profiler.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 class HeapSnapshotsCollection; 151 class HeapSnapshotsCollection;
152 152
153 // HeapSnapshot represents a single heap snapshot. It is stored in 153 // HeapSnapshot represents a single heap snapshot. It is stored in
154 // HeapSnapshotsCollection, which is also a factory for 154 // HeapSnapshotsCollection, which is also a factory for
155 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap 155 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap
156 // to be able to return them even if they were collected. 156 // to be able to return them even if they were collected.
157 // HeapSnapshotGenerator fills in a HeapSnapshot. 157 // HeapSnapshotGenerator fills in a HeapSnapshot.
158 class HeapSnapshot { 158 class HeapSnapshot {
159 public: 159 public:
160 enum Type {
161 kFull = v8::HeapSnapshot::kFull
162 };
163
164 HeapSnapshot(HeapSnapshotsCollection* collection, 160 HeapSnapshot(HeapSnapshotsCollection* collection,
165 Type type,
166 const char* title, 161 const char* title,
167 unsigned uid); 162 unsigned uid);
168 void Delete(); 163 void Delete();
169 164
170 HeapSnapshotsCollection* collection() { return collection_; } 165 HeapSnapshotsCollection* collection() { return collection_; }
171 Type type() { return type_; }
172 const char* title() { return title_; } 166 const char* title() { return title_; }
173 unsigned uid() { return uid_; } 167 unsigned uid() { return uid_; }
174 size_t RawSnapshotSize() const; 168 size_t RawSnapshotSize() const;
175 HeapEntry* root() { return &entries_[root_index_]; } 169 HeapEntry* root() { return &entries_[root_index_]; }
176 HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; } 170 HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; }
177 HeapEntry* natives_root() { return &entries_[natives_root_index_]; } 171 HeapEntry* natives_root() { return &entries_[natives_root_index_]; }
178 HeapEntry* gc_subroot(int index) { 172 HeapEntry* gc_subroot(int index) {
179 return &entries_[gc_subroot_indexes_[index]]; 173 return &entries_[gc_subroot_indexes_[index]];
180 } 174 }
181 List<HeapEntry>& entries() { return entries_; } 175 List<HeapEntry>& entries() { return entries_; }
(...skipping 14 matching lines...) Expand all
196 HeapEntry* AddNativesRootEntry(); 190 HeapEntry* AddNativesRootEntry();
197 HeapEntry* GetEntryById(SnapshotObjectId id); 191 HeapEntry* GetEntryById(SnapshotObjectId id);
198 List<HeapEntry*>* GetSortedEntriesList(); 192 List<HeapEntry*>* GetSortedEntriesList();
199 void FillChildren(); 193 void FillChildren();
200 194
201 void Print(int max_depth); 195 void Print(int max_depth);
202 void PrintEntriesSize(); 196 void PrintEntriesSize();
203 197
204 private: 198 private:
205 HeapSnapshotsCollection* collection_; 199 HeapSnapshotsCollection* collection_;
206 Type type_;
207 const char* title_; 200 const char* title_;
208 unsigned uid_; 201 unsigned uid_;
209 int root_index_; 202 int root_index_;
210 int gc_roots_index_; 203 int gc_roots_index_;
211 int natives_root_index_; 204 int natives_root_index_;
212 int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags]; 205 int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags];
213 List<HeapEntry> entries_; 206 List<HeapEntry> entries_;
214 List<HeapGraphEdge> edges_; 207 List<HeapGraphEdge> edges_;
215 List<HeapGraphEdge*> children_; 208 List<HeapGraphEdge*> children_;
216 List<HeapEntry*> sorted_entries_; 209 List<HeapEntry*> sorted_entries_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 291
299 Heap* heap() const { return ids_.heap(); } 292 Heap* heap() const { return ids_.heap(); }
300 293
301 bool is_tracking_objects() { return is_tracking_objects_; } 294 bool is_tracking_objects() { return is_tracking_objects_; }
302 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { 295 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
303 return ids_.PushHeapObjectsStats(stream); 296 return ids_.PushHeapObjectsStats(stream);
304 } 297 }
305 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } 298 void StartHeapObjectsTracking() { is_tracking_objects_ = true; }
306 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } 299 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); }
307 300
308 HeapSnapshot* NewSnapshot( 301 HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
309 HeapSnapshot::Type type, const char* name, unsigned uid);
310 void SnapshotGenerationFinished(HeapSnapshot* snapshot); 302 void SnapshotGenerationFinished(HeapSnapshot* snapshot);
311 List<HeapSnapshot*>* snapshots() { return &snapshots_; } 303 List<HeapSnapshot*>* snapshots() { return &snapshots_; }
312 HeapSnapshot* GetSnapshot(unsigned uid); 304 HeapSnapshot* GetSnapshot(unsigned uid);
313 void RemoveSnapshot(HeapSnapshot* snapshot); 305 void RemoveSnapshot(HeapSnapshot* snapshot);
314 306
315 StringsStorage* names() { return &names_; } 307 StringsStorage* names() { return &names_; }
316 TokenEnumerator* token_enumerator() { return token_enumerator_; } 308 TokenEnumerator* token_enumerator() { return token_enumerator_; }
317 309
318 SnapshotObjectId FindObjectId(Address object_addr) { 310 SnapshotObjectId FindObjectId(Address object_addr) {
319 return ids_.FindEntry(object_addr); 311 return ids_.FindEntry(object_addr);
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 friend class HeapSnapshotJSONSerializerIterator; 681 friend class HeapSnapshotJSONSerializerIterator;
690 682
691 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 683 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
692 }; 684 };
693 685
694 686
695 } } // namespace v8::internal 687 } } // namespace v8::internal
696 688
697 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ 689 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
698 690
OLDNEW
« no previous file with comments | « src/heap-profiler.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698