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

Unified Diff: src/api.cc

Issue 306053003: Add API support for passing a C++ function as a microtask callback (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | src/isolate.cc » ('J')
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 ca552fc60f6ba44140461666f730411a92de0fe4..f966177c6fd6d76f3d764bfeb3bab1b8bdf2d2c2 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6664,6 +6664,18 @@ void Isolate::EnqueueMicrotask(Handle<Function> microtask) {
}
+void Isolate::EnqueueMicrotask(MicrotaskCallback microtask, void* data) {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+ i::HandleScope scope(isolate);
+ i::Handle<i::CallHandlerInfo> callback_info =
dcarney 2014/06/02 07:22:10 if you're going to reuse the CallHandlerInfo struc
adamk 2014/06/02 16:41:50 I'm guessing this might be the source of my try jo
+ i::Handle<i::CallHandlerInfo>::cast(
+ isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE));
+ SET_FIELD_WRAPPED(callback_info, set_callback, microtask);
+ SET_FIELD_WRAPPED(callback_info, set_data, data);
+ isolate->EnqueueMicrotask(callback_info);
+}
+
+
void Isolate::SetAutorunMicrotasks(bool autorun) {
reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun);
}
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698