diff options
author | Gus Caplan <me@gus.host> | 2018-03-04 23:59:51 +0300 |
---|---|---|
committer | Gus Caplan <me@gus.host> | 2018-03-07 21:19:38 +0300 |
commit | c9b4de55c061ecb8d64cda9e36821c21f8150925 (patch) | |
tree | 51813a516bb2ac257ff51d8b1a9059a30bc07013 /src/node_context_data.h | |
parent | a6c14b2f4259a9ca080a7b486dc934e4ccef8938 (diff) |
src: standardise context embedder indices
PR-URL: https://github.com/nodejs/node/pull/19135
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Diffstat (limited to 'src/node_context_data.h')
-rw-r--r-- | src/node_context_data.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/node_context_data.h b/src/node_context_data.h new file mode 100644 index 00000000000..9d3145bb800 --- /dev/null +++ b/src/node_context_data.h @@ -0,0 +1,25 @@ +#ifndef SRC_NODE_CONTEXT_DATA_H_ +#define SRC_NODE_CONTEXT_DATA_H_ + +namespace node { + +// Pick an index that's hopefully out of the way when we're embedded inside +// another application. Performance-wise or memory-wise it doesn't matter: +// Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray, +// worst case we pay a one-time penalty for resizing the array. +#ifndef NODE_CONTEXT_EMBEDDER_DATA_INDEX +#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32 +#endif + +#ifndef NODE_CONTEXT_SANDBOX_OBJECT_INDEX +#define NODE_CONTEXT_SANDBOX_OBJECT_INDEX 33 +#endif + +enum ContextEmbedderIndex { + kEnvironment = NODE_CONTEXT_EMBEDDER_DATA_INDEX, + kSandboxObject = NODE_CONTEXT_SANDBOX_OBJECT_INDEX, +}; + +} // namespace node + +#endif // SRC_NODE_CONTEXT_DATA_H_ |