Skip to content

Commit 44743ea

Browse files
zcbenzindutny
authored andcommitted
src: change kIsolateSlot to 3
The slot 0 and 1 had already been taken by "gin" and "blink" in Chrome, and the size of isolate's slots is 4 by default, so using 3 should hopefully make node work independently when embedded into other application. Reviewed-By: Fedor Indutny <fedor@indutny.com>
1 parent 807acf7 commit 44743ea

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/env.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
// a nightmare so let's make the preprocessor generate them for us.
3838
//
3939
// Make sure that any macros defined here are undefined again at the bottom
40-
// of context-inl.h. The sole exception is NODE_CONTEXT_EMBEDDER_DATA_INDEX,
41-
// it may have been defined externally.
40+
// of context-inl.h. The exceptions are NODE_CONTEXT_EMBEDDER_DATA_INDEX
41+
// and NODE_ISOLATE_SLOT, they may have been defined externally.
4242
namespace node {
4343

4444
// Pick an index that's hopefully out of the way when we're embedded inside
@@ -49,6 +49,14 @@ namespace node {
4949
#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32
5050
#endif
5151

52+
// The slot 0 and 1 had already been taken by "gin" and "blink" in Chrome,
53+
// and the size of isolate's slots is 4 by default, so using 3 should
54+
// hopefully make node work independently when embedded into other
55+
// application.
56+
#ifndef NODE_ISOLATE_SLOT
57+
#define NODE_ISOLATE_SLOT 3
58+
#endif
59+
5260
// Strings are per-isolate primitives but Environment proxies them
5361
// for the sake of convenience.
5462
#define PER_ISOLATE_STRING_PROPERTIES(V) \
@@ -430,7 +438,7 @@ class Environment {
430438
#undef V
431439

432440
private:
433-
static const int kIsolateSlot = 0;
441+
static const int kIsolateSlot = NODE_ISOLATE_SLOT;
434442

435443
class GCInfo;
436444
class IsolateData;

0 commit comments

Comments
 (0)