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

Unified Diff: src/api.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8-profiler.h ('k') | src/heap-profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index dfa57654db7110a402821b3e2b6ca562ffb18139..1d75db57b36e13fe4559da93958fdde82d31ccd6 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5807,6 +5807,13 @@ intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) {
}
+HeapProfiler* Isolate::GetHeapProfiler() {
+ i::HeapProfiler* heap_profiler =
+ reinterpret_cast<i::Isolate*>(this)->heap_profiler();
+ return reinterpret_cast<HeapProfiler*>(heap_profiler);
+}
+
+
void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
@@ -6708,11 +6715,11 @@ static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
void HeapSnapshot::Delete() {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::Delete");
- if (i::HeapProfiler::GetSnapshotsCount() > 1) {
+ if (isolate->heap_profiler()->GetSnapshotsCount() > 1) {
ToInternal(this)->Delete();
} else {
// If this is the last snapshot, clean up all accessory data as well.
- i::HeapProfiler::DeleteAllSnapshots();
+ isolate->heap_profiler()->DeleteAllSnapshots();
}
}
@@ -6797,7 +6804,12 @@ void HeapSnapshot::Serialize(OutputStream* stream,
int HeapProfiler::GetSnapshotsCount() {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
- return i::HeapProfiler::GetSnapshotsCount();
+ return isolate->heap_profiler()->GetSnapshotsCount();
+}
+
+
+int HeapProfiler::GetSnapshotCount() {
+ return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount();
}
@@ -6805,7 +6817,13 @@ const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
return reinterpret_cast<const HeapSnapshot*>(
- i::HeapProfiler::GetSnapshot(index));
+ isolate->heap_profiler()->GetSnapshot(index));
+}
+
+
+const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) {
+ return reinterpret_cast<const HeapSnapshot*>(
+ reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index));
}
@@ -6813,7 +6831,13 @@ const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
return reinterpret_cast<const HeapSnapshot*>(
- i::HeapProfiler::FindSnapshot(uid));
+ isolate->heap_profiler()->FindSnapshot(uid));
+}
+
+
+const HeapSnapshot* HeapProfiler::FindHeapSnapshot(unsigned uid) {
+ return reinterpret_cast<const HeapSnapshot*>(
+ reinterpret_cast<i::HeapProfiler*>(this)->FindSnapshot(uid));
}
@@ -6821,7 +6845,13 @@ SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Value> value) {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotObjectId");
i::Handle<i::Object> obj = Utils::OpenHandle(*value);
- return i::HeapProfiler::GetSnapshotObjectId(obj);
+ return isolate->heap_profiler()->GetSnapshotObjectId(obj);
+}
+
+
+SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) {
+ i::Handle<i::Object> obj = Utils::OpenHandle(*value);
+ return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj);
}
@@ -6840,36 +6870,67 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
UNREACHABLE();
}
return reinterpret_cast<const HeapSnapshot*>(
- i::HeapProfiler::TakeSnapshot(
+ isolate->heap_profiler()->TakeSnapshot(
*Utils::OpenHandle(*title), internal_type, control, resolver));
}
+const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
+ Handle<String> title,
+ ActivityControl* control,
+ ObjectNameResolver* resolver) {
+ return reinterpret_cast<const HeapSnapshot*>(
+ reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot(
+ *Utils::OpenHandle(*title), i::HeapSnapshot::kFull,
+ control, resolver));
+}
+
+
void HeapProfiler::StartHeapObjectsTracking() {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::StartHeapObjectsTracking");
- i::HeapProfiler::StartHeapObjectsTracking();
+ isolate->heap_profiler()->StartHeapObjectsTracking();
+}
+
+
+void HeapProfiler::StartTrackingHeapObjects() {
+ reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking();
}
void HeapProfiler::StopHeapObjectsTracking() {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::StopHeapObjectsTracking");
- i::HeapProfiler::StopHeapObjectsTracking();
+ isolate->heap_profiler()->StopHeapObjectsTracking();
+}
+
+
+void HeapProfiler::StopTrackingHeapObjects() {
+ reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking();
}
SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::PushHeapObjectsStats");
- return i::HeapProfiler::PushHeapObjectsStats(stream);
+ return isolate->heap_profiler()->PushHeapObjectsStats(stream);
+}
+
+
+SnapshotObjectId HeapProfiler::GetHeapStats(OutputStream* stream) {
+ return reinterpret_cast<i::HeapProfiler*>(this)->PushHeapObjectsStats(stream);
}
void HeapProfiler::DeleteAllSnapshots() {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
- i::HeapProfiler::DeleteAllSnapshots();
+ isolate->heap_profiler()->DeleteAllSnapshots();
+}
+
+
+void HeapProfiler::DeleteAllHeapSnapshots() {
+ reinterpret_cast<i::HeapProfiler*>(this)->DeleteAllSnapshots();
}
@@ -6880,6 +6941,13 @@ void HeapProfiler::DefineWrapperClass(uint16_t class_id,
}
+void HeapProfiler::SetWrapperClassInfoProvider(uint16_t class_id,
+ WrapperInfoCallback callback) {
+ reinterpret_cast<i::HeapProfiler*>(this)->DefineWrapperClass(class_id,
+ callback);
+}
+
+
int HeapProfiler::GetPersistentHandleCount() {
i::Isolate* isolate = i::Isolate::Current();
return isolate->global_handles()->NumberOfGlobalHandles();
@@ -6887,7 +6955,13 @@ int HeapProfiler::GetPersistentHandleCount() {
size_t HeapProfiler::GetMemorySizeUsedByProfiler() {
- return i::HeapProfiler::GetMemorySizeUsedByProfiler();
+ return i::Isolate::Current()->heap_profiler()->GetMemorySizeUsedByProfiler();
+}
+
+
+size_t HeapProfiler::GetProfilerMemorySize() {
+ return reinterpret_cast<i::HeapProfiler*>(this)->
+ GetMemorySizeUsedByProfiler();
}
« no previous file with comments | « include/v8-profiler.h ('k') | src/heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698