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

Unified Diff: src/api.cc

Issue 8278001: Return empty HeapStatistics for uninitialized isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « no previous file | no next file » | 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 a2cf7142bc8e940a458faf118d19fdada04d104e..171979cc84dfb8ed344139ca48d895b3f947e025 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3961,6 +3961,15 @@ HeapStatistics::HeapStatistics(): total_heap_size_(0),
void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
+ if (!i::Isolate::Current()->IsInitialized()) {
+ // Isolate is unitialized thus heap is not configured yet.
+ heap_statistics->set_total_heap_size(0);
+ heap_statistics->set_total_heap_size_executable(0);
+ heap_statistics->set_used_heap_size(0);
+ heap_statistics->set_heap_size_limit(0);
+ return;
+ }
+
i::Heap* heap = i::Isolate::Current()->heap();
heap_statistics->set_total_heap_size(heap->CommittedMemory());
heap_statistics->set_total_heap_size_executable(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698