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

Side by Side Diff: src/heap-profiler.h

Issue 101393002: Remove HeapSnapshotsCollection class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/heap-profiler.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 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-2010 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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_HEAP_PROFILER_H_ 28 #ifndef V8_HEAP_PROFILER_H_
29 #define V8_HEAP_PROFILER_H_ 29 #define V8_HEAP_PROFILER_H_
30 30
31 #include "heap-snapshot-generator-inl.h" 31 #include "heap-snapshot-generator-inl.h"
32 #include "isolate.h" 32 #include "isolate.h"
33 #include "smart-pointers.h"
33 34
34 namespace v8 { 35 namespace v8 {
35 namespace internal { 36 namespace internal {
36 37
37 class HeapSnapshot; 38 class HeapSnapshot;
38 class HeapSnapshotsCollection;
39 39
40 class HeapProfiler { 40 class HeapProfiler {
41 public: 41 public:
42 explicit HeapProfiler(Heap* heap); 42 explicit HeapProfiler(Heap* heap);
43 ~HeapProfiler(); 43 ~HeapProfiler();
44 44
45 size_t GetMemorySizeUsedByProfiler(); 45 size_t GetMemorySizeUsedByProfiler();
46 46
47 HeapSnapshot* TakeSnapshot( 47 HeapSnapshot* TakeSnapshot(
48 const char* name, 48 const char* name,
49 v8::ActivityControl* control, 49 v8::ActivityControl* control,
50 v8::HeapProfiler::ObjectNameResolver* resolver); 50 v8::HeapProfiler::ObjectNameResolver* resolver);
51 HeapSnapshot* TakeSnapshot( 51 HeapSnapshot* TakeSnapshot(
52 String* name, 52 String* name,
53 v8::ActivityControl* control, 53 v8::ActivityControl* control,
54 v8::HeapProfiler::ObjectNameResolver* resolver); 54 v8::HeapProfiler::ObjectNameResolver* resolver);
55 55
56 void StartHeapObjectsTracking(bool track_allocations); 56 void StartHeapObjectsTracking(bool track_allocations);
57 void StopHeapObjectsTracking(); 57 void StopHeapObjectsTracking();
58 AllocationTracker* allocation_tracker() { return *allocation_tracker_; }
59 HeapObjectsMap* heap_object_map() { return *ids_; }
60 StringsStorage* names() { return *names_; }
58 61
59 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 62 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
60 int GetSnapshotsCount(); 63 int GetSnapshotsCount();
61 HeapSnapshot* GetSnapshot(int index); 64 HeapSnapshot* GetSnapshot(int index);
62 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 65 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
63 void DeleteAllSnapshots(); 66 void DeleteAllSnapshots();
67 void RemoveSnapshot(HeapSnapshot* snapshot);
64 68
65 void ObjectMoveEvent(Address from, Address to, int size); 69 void ObjectMoveEvent(Address from, Address to, int size);
66 70
67 void AllocationEvent(Address addr, int size); 71 void AllocationEvent(Address addr, int size);
68 72
69 void UpdateObjectSizeEvent(Address addr, int size); 73 void UpdateObjectSizeEvent(Address addr, int size);
70 74
71 void DefineWrapperClass( 75 void DefineWrapperClass(
72 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 76 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
73 77
74 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 78 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
75 Object** wrapper); 79 Object** wrapper);
76 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); 80 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
77 81
78 bool is_tracking_object_moves() const { return is_tracking_object_moves_; } 82 bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
79 bool is_tracking_allocations() const { return is_tracking_allocations_; } 83 bool is_tracking_allocations() { return !allocation_tracker_.is_empty(); }
80 84
81 int FindUntrackedObjects() { 85 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
82 return snapshots_->FindUntrackedObjects();
83 }
84 86
85 private: 87 private:
86 Heap* heap() const { return snapshots_->heap(); } 88 Heap* heap() const { return ids_->heap(); }
87 89
88 HeapSnapshotsCollection* snapshots_; 90 // Mapping from HeapObject addresses to objects' uids.
91 SmartPointer<HeapObjectsMap> ids_;
92 List<HeapSnapshot*> snapshots_;
93 SmartPointer<StringsStorage> names_;
89 unsigned next_snapshot_uid_; 94 unsigned next_snapshot_uid_;
90 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 95 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
91 bool is_tracking_allocations_; 96 SmartPointer<AllocationTracker> allocation_tracker_;
92 bool is_tracking_object_moves_; 97 bool is_tracking_object_moves_;
93 }; 98 };
94 99
95 } } // namespace v8::internal 100 } } // namespace v8::internal
96 101
97 #endif // V8_HEAP_PROFILER_H_ 102 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698