
Responses are always returned asynchronously as JS promises (the newly added zx.objectWaitOne() helper also returns a promise). The wait and response are serviced by libasync waits, and so must be cancelled when the v8 context is torn down. The (default) dispatcher must outlive any v8 contexts with which it is used. Bug: 883496 Change-Id: Ib8735c6ec4196d36b53929341d57e843abaeea3b Reviewed-on: https://chromium-review.googlesource.com/c/1240204 Commit-Queue: Scott Graham <scottmg@chromium.org> Reviewed-by: Wez <wez@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#600238}
Gin - Lightweight bindings for V8
This directory contains Gin, a set of utilities to make working with V8 easier.
Here are some of the key bits:
-
converter.h: Templatized JS ↔ C++ conversion routines for many common C++ types. You can define your own by specializing Converter.
-
function_template.h: Create JavaScript functions that dispatch to any C++ function, member function pointer, or base::Callback.
-
object_template_builder.h: A handy utility for creation of v8::ObjectTemplate.
-
wrappable.h: Base class for C++ classes that want to be owned by the V8 GC. Wrappable objects are automatically deleted when GC discovers that nothing in the V8 heap refers to them. This is also an easy way to expose C++ objects to JavaScript.
-
runner.h: Create script contexts and run code in them.
-
module_runner_delegate.h: A delegate for runner that implements a subset of the AMD module specification. Also see modules/ with some example modules.