Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 43a7ea029cbf551f4a25f3ba40c444a6a617ca6a..c80162aa85e2333ff7db6f0552aa479c66da0a2c 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -7646,6 +7646,19 @@ void CpuProfiler::DeleteAllCpuProfiles() { |
} |
+void CpuProfiler::SetIdle(bool is_idle) { |
+ i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); |
+ i::StateTag state = isolate->current_vm_state(); |
+ ASSERT(state == i::EXTERNAL || state == i::IDLE); |
+ if (isolate->js_entry_sp() != NULL) return; |
+ if (is_idle) { |
+ isolate->set_current_vm_state(i::IDLE); |
+ } else if (state == i::IDLE) { |
+ isolate->set_current_vm_state(i::EXTERNAL); |
+ } |
+} |
+ |
+ |
static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { |
return const_cast<i::HeapGraphEdge*>( |
reinterpret_cast<const i::HeapGraphEdge*>(edge)); |