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

Unified Diff: src/d8.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: properly rebase Created 4 years, 7 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/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 9466ab7d3a727c2fe12d70ac977df0b0cac57f35..c0fc2881ae05eaf19276f22e51b37aa26635dc5e 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -887,6 +887,10 @@ void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
NewStringType::kNormal).ToLocalChecked());
}
+void Shell::FlushMicrotasks(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ Isolate* isolate = args.GetIsolate();
+ isolate->RunMicrotasks();
+}
void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) {
HandleScope handle_scope(isolate);
@@ -1204,6 +1208,11 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
.ToLocalChecked(),
os_templ);
+ global_template->Set(
+ String::NewFromUtf8(isolate, "flushMicrotasks", NewStringType::kNormal)
+ .ToLocalChecked(),
+ FunctionTemplate::New(isolate, FlushMicrotasks));
Dan Ehrenberg 2016/05/04 22:52:36 I worry that this flushMicrotasks call won't alway
caitp (gmail) 2016/05/06 18:45:25 the assertLater thing is kind of a mess, I would p
+
return global_template;
}

Powered by Google App Engine
This is Rietveld 408576698