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

Unified Diff: src/api.cc

Issue 6685084: Add support for CPU and heap profiles deletion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemente per-profile deletion Created 9 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 side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698