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

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

Issue 12907006: Isolatify HeapProfiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Prohibited construction and destruction of v8::HeapProfiler 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/api.cc ('k') | 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 28 matching lines...) Expand all
39 #define HEAP_PROFILE(heap, call) \ 39 #define HEAP_PROFILE(heap, call) \
40 do { \ 40 do { \
41 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \ 41 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \
42 if (profiler != NULL && profiler->is_profiling()) { \ 42 if (profiler != NULL && profiler->is_profiling()) { \
43 profiler->call; \ 43 profiler->call; \
44 } \ 44 } \
45 } while (false) 45 } while (false)
46 46
47 class HeapProfiler { 47 class HeapProfiler {
48 public: 48 public:
49 static void SetUp(); 49 explicit HeapProfiler(Heap* heap);
50 static void TearDown(); 50 ~HeapProfiler();
51 51
52 static size_t GetMemorySizeUsedByProfiler(); 52 size_t GetMemorySizeUsedByProfiler();
53 53
54 static HeapSnapshot* TakeSnapshot( 54 HeapSnapshot* TakeSnapshot(
55 const char* name, 55 const char* name,
56 int type, 56 int type,
57 v8::ActivityControl* control, 57 v8::ActivityControl* control,
58 v8::HeapProfiler::ObjectNameResolver* resolver); 58 v8::HeapProfiler::ObjectNameResolver* resolver);
59 static HeapSnapshot* TakeSnapshot( 59 HeapSnapshot* TakeSnapshot(
60 String* name, 60 String* name,
61 int type, 61 int type,
62 v8::ActivityControl* control, 62 v8::ActivityControl* control,
63 v8::HeapProfiler::ObjectNameResolver* resolver); 63 v8::HeapProfiler::ObjectNameResolver* resolver);
64 64
65 static void StartHeapObjectsTracking(); 65 void StartHeapObjectsTracking();
66 static void StopHeapObjectsTracking(); 66 void StopHeapObjectsTracking();
67 static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 67 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
68 static int GetSnapshotsCount(); 68 int GetSnapshotsCount();
69 static HeapSnapshot* GetSnapshot(int index); 69 HeapSnapshot* GetSnapshot(int index);
70 static HeapSnapshot* FindSnapshot(unsigned uid); 70 HeapSnapshot* FindSnapshot(unsigned uid);
71 static SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 71 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
72 static void DeleteAllSnapshots(); 72 void DeleteAllSnapshots();
73 73
74 void ObjectMoveEvent(Address from, Address to); 74 void ObjectMoveEvent(Address from, Address to);
75 75
76 void DefineWrapperClass( 76 void DefineWrapperClass(
77 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 77 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
78 78
79 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 79 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
80 Object** wrapper); 80 Object** wrapper);
81 INLINE(bool is_profiling()) { 81 INLINE(bool is_profiling()) {
82 return snapshots_->is_tracking_objects(); 82 return snapshots_->is_tracking_objects();
83 } 83 }
84 84
85 private: 85 private:
86 explicit HeapProfiler(Heap* heap);
87 ~HeapProfiler();
88 HeapSnapshot* TakeSnapshotImpl(
89 const char* name,
90 int type,
91 v8::ActivityControl* control,
92 v8::HeapProfiler::ObjectNameResolver* resolver);
93 HeapSnapshot* TakeSnapshotImpl(
94 String* name,
95 int type,
96 v8::ActivityControl* control,
97 v8::HeapProfiler::ObjectNameResolver* resolver);
98 void ResetSnapshots();
99
100 void StartHeapObjectsTrackingImpl();
101 void StopHeapObjectsTrackingImpl();
102 SnapshotObjectId PushHeapObjectsStatsImpl(OutputStream* stream);
103
104 Heap* heap() const { return snapshots_->heap(); } 86 Heap* heap() const { return snapshots_->heap(); }
105 87
106 HeapSnapshotsCollection* snapshots_; 88 HeapSnapshotsCollection* snapshots_;
107 unsigned next_snapshot_uid_; 89 unsigned next_snapshot_uid_;
108 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 90 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
109 }; 91 };
110 92
111 } } // namespace v8::internal 93 } } // namespace v8::internal
112 94
113 #endif // V8_HEAP_PROFILER_H_ 95 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698