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

Unified Diff: src/api.cc

Issue 263933002: Introduce a microtask suppression scope and move microtask methods to isolate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 8 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.h ('k') | src/isolate.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 82e4c54ba517e606257d0e5a73c27890d6348f51..41b5a45a70ebf78e86d271b1c68df2ddd29dd1d8 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6455,21 +6455,17 @@ void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
void V8::RunMicrotasks(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- i::HandleScope scope(i_isolate);
- i::V8::RunMicrotasks(i_isolate);
+ isolate->RunMicrotasks();
}
void V8::EnqueueMicrotask(Isolate* isolate, Handle<Function> microtask) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- ENTER_V8(i_isolate);
- i::Execution::EnqueueMicrotask(i_isolate, Utils::OpenHandle(*microtask));
+ isolate->EnqueueMicrotask(microtask);
}
void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) {
- reinterpret_cast<i::Isolate*>(isolate)->set_autorun_microtasks(autorun);
+ isolate->SetAutorunMicrotasks(autorun);
}
@@ -6593,6 +6589,18 @@ Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() {
}
+Isolate::SuppressMicrotaskExecutionScope::SuppressMicrotaskExecutionScope(
+ Isolate* isolate)
+ : isolate_(reinterpret_cast<i::Isolate*>(isolate)) {
+ isolate_->handle_scope_implementer()->IncrementCallDepth();
+}
+
+
+Isolate::SuppressMicrotaskExecutionScope::~SuppressMicrotaskExecutionScope() {
+ isolate_->handle_scope_implementer()->DecrementCallDepth();
+}
+
+
void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
if (!isolate->IsInitialized()) {
@@ -6632,6 +6640,25 @@ void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
}
+void Isolate::RunMicrotasks() {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
+ i::HandleScope scope(i_isolate);
+ i_isolate->RunMicrotasks();
+}
+
+
+void Isolate::EnqueueMicrotask(Handle<Function> microtask) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
+ ENTER_V8(i_isolate);
+ i::Execution::EnqueueMicrotask(i_isolate, Utils::OpenHandle(*microtask));
+}
+
+
+void Isolate::SetAutorunMicrotasks(bool autorun) {
+ reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun);
+}
+
+
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
: str_(NULL), length_(0) {
i::Isolate* isolate = i::Isolate::Current();
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698