Skip to content

Commit 756b622

Browse files
committed
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.
1 parent 81655a2 commit 756b622

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2520
-1704
lines changed

node.gyp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
'src/udp_wrap.cc',
117117
'src/uv.cc',
118118
# headers to make for a more pleasant IDE experience
119+
'src/env.h',
120+
'src/env-inl.h',
119121
'src/handle_wrap.h',
120122
'src/node.h',
121123
'src/node_buffer.h',
@@ -124,6 +126,7 @@
124126
'src/node_extensions.h',
125127
'src/node_file.h',
126128
'src/node_http_parser.h',
129+
'src/node_internals.h',
127130
'src/node_javascript.h',
128131
'src/node_root_certs.h',
129132
'src/node_version.h',
@@ -139,6 +142,8 @@
139142
'src/string_bytes.h',
140143
'src/stream_wrap.h',
141144
'src/tree.h',
145+
'src/util.h',
146+
'src/util-inl.h',
142147
'deps/http_parser/http_parser.h',
143148
'<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
144149
# javascript files to make for an even more pleasant IDE experience

0 commit comments

Comments
 (0)