diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-08-07 14:02:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 14:02:29 -0400 |
commit | e438ac2c74c823882dc9c9ecde2a9e9ed7bcfb4b (patch) | |
tree | 480b2daa83e31b26c5d611feff021674d289e492 /core/libdeno/api.cc | |
parent | 5350abbc7ffdba6d17166fa00ad89e86979a43f7 (diff) |
Add op_id throughout op API (#2734)
Removes the magic number hack to switch between flatbuffers and the
minimal dispatcher.
Adds machinery to pass the op_id through the shared_queue.
Diffstat (limited to 'core/libdeno/api.cc')
-rw-r--r-- | core/libdeno/api.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/libdeno/api.cc b/core/libdeno/api.cc index 61eeb43ca..1e6b5dfbf 100644 --- a/core/libdeno/api.cc +++ b/core/libdeno/api.cc @@ -159,10 +159,11 @@ void deno_pinned_buf_delete(deno_pinned_buf* buf) { auto _ = deno::PinnedBuf(buf); } -void deno_respond(Deno* d_, void* user_data, deno_buf buf) { +void deno_respond(Deno* d_, void* user_data, deno_op_id op_id, deno_buf buf) { auto* d = unwrap(d_); if (d->current_args_ != nullptr) { // Synchronous response. + // Note op_id is not passed back in the case of synchronous response. if (buf.data_ptr != nullptr) { auto ab = deno::ImportBuf(d, buf); d->current_args_->GetReturnValue().Set(ab); @@ -187,12 +188,13 @@ void deno_respond(Deno* d_, void* user_data, deno_buf buf) { return; } - v8::Local<v8::Value> args[1]; + v8::Local<v8::Value> args[2]; int argc = 0; if (buf.data_ptr != nullptr) { - args[0] = deno::ImportBuf(d, buf); - argc = 1; + args[0] = v8::Integer::New(d->isolate_, op_id); + args[1] = deno::ImportBuf(d, buf); + argc = 2; } auto v = recv_->Call(context, context->Global(), argc, args); |