This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

src: add multi-context support

This commit makes it possible to use multiple V8 execution contexts
within a single event loop.  Put another way, handle and request wrap
objects now "remember" the context they belong to and switch back to
that context when the time comes to call into JS land.

This could have been done in a quick and hacky way by calling
v8::Object::GetCreationContext() on the wrap object right before
making a callback but that leaves a fairly wide margin for bugs.

Instead, we make the context explicit through a new Environment class
that encapsulates everything (or almost everything) that belongs to
the context.  Variables that used to be a static or a global are now
members of the aforementioned class.  An additional benefit is that
this approach should make it relatively straightforward to add full
isolate support in due course.

There is no JavaScript API yet but that will be added in the near
future.

This work was graciously sponsored by GitHub, Inc.
  • Loading branch information...
bnoordhuis committed Aug 10, 2013
1 parent 81655a2 commit 756b6222956b5d25b2e7db81f4e79033a3a4d20e
@@ -116,6 +116,8 @@
'src/udp_wrap.cc',
'src/uv.cc',
# headers to make for a more pleasant IDE experience
'src/env.h',
'src/env-inl.h',
'src/handle_wrap.h',
'src/node.h',
'src/node_buffer.h',
@@ -124,6 +126,7 @@
'src/node_extensions.h',
'src/node_file.h',
'src/node_http_parser.h',
'src/node_internals.h',
'src/node_javascript.h',
'src/node_root_certs.h',
'src/node_version.h',
@@ -139,6 +142,8 @@
'src/string_bytes.h',
'src/stream_wrap.h',
'src/tree.h',
'src/util.h',
'src/util-inl.h',
'deps/http_parser/http_parser.h',
'<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
# javascript files to make for an even more pleasant IDE experience
Oops, something went wrong.

0 comments on commit 756b622

Please sign in to comment.