Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 667aa60b7ef0051d1ebb77913693e84e9233bd7e..d0159fbbc8af1b9a07df3e989d89797182195176 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5077,6 +5077,20 @@ const CpuProfileNode* CpuProfileNode::GetChild(int index) const { |
} |
+void CpuProfile::Delete() const { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ IsDeadCheck(isolate, "v8::CpuProfile::Delete"); |
+ i::CpuProfiler::DeleteProfile( |
+ const_cast<i::CpuProfile*>( |
Vitaly Repeshko
2011/03/22 14:30:36
Dropping "const" will allow to avoid this const_ca
mnaganov (inactive)
2011/03/22 16:03:09
Done.
|
+ reinterpret_cast<const i::CpuProfile*>(this))); |
+ if (i::CpuProfiler::GetProfilesCount() == 0 && |
+ !i::CpuProfiler::HasDetachedProfiles()) { |
+ // If this was the last profile, clean up all accessory data as well. |
+ i::CpuProfiler::DeleteAllProfiles(); |
+ } |
+} |
+ |
+ |
unsigned CpuProfile::GetUid() const { |
i::Isolate* isolate = i::Isolate::Current(); |
IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); |
@@ -5156,6 +5170,13 @@ const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, |
} |
+void CpuProfiler::DeleteAllProfiles() { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); |
+ i::CpuProfiler::DeleteAllProfiles(); |
+} |
+ |
+ |
static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { |
return const_cast<i::HeapGraphEdge*>( |
reinterpret_cast<const i::HeapGraphEdge*>(edge)); |
@@ -5362,6 +5383,18 @@ static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { |
} |
+void HeapSnapshot::Delete() const { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); |
+ if (i::HeapProfiler::GetSnapshotsCount() > 1) { |
+ ToInternal(this)->Delete(); |
+ } else { |
+ // If this is the last snapshot, clean up all accessory data as well. |
+ i::HeapProfiler::DeleteAllSnapshots(); |
+ } |
+} |
+ |
+ |
HeapSnapshot::Type HeapSnapshot::GetType() const { |
i::Isolate* isolate = i::Isolate::Current(); |
IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); |
@@ -5471,6 +5504,13 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, |
} |
+void HeapProfiler::DeleteAllSnapshots() { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); |
+ i::HeapProfiler::DeleteAllSnapshots(); |
+} |
+ |
+ |
void HeapProfiler::DefineWrapperClass(uint16_t class_id, |
WrapperInfoCallback callback) { |
i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, |