diff options
Diffstat (limited to 'src/node_main_instance.h')
-rw-r--r-- | src/node_main_instance.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/node_main_instance.h b/src/node_main_instance.h index 0a8be137a0..615fda1f49 100644 --- a/src/node_main_instance.h +++ b/src/node_main_instance.h @@ -15,6 +15,18 @@ namespace node { // We may be able to create an abstract class to reuse some of the routines. class NodeMainInstance { public: + // An array of indexes that can be used to deserialize data from a V8 + // snapshot. + struct IndexArray { + const size_t* data; + size_t length; + + size_t Get(size_t index) const { + DCHECK_LT(index, length); + return data[index]; + } + }; + // To create a main instance that does not own the isoalte, // The caller needs to do: // @@ -45,12 +57,15 @@ class NodeMainInstance { uv_loop_t* event_loop, MultiIsolatePlatform* platform, const std::vector<std::string>& args, - const std::vector<std::string>& exec_args); + const std::vector<std::string>& exec_args, + const IndexArray* per_isolate_data_indexes = nullptr); ~NodeMainInstance(); // Start running the Node.js instances, return the exit code when finished. int Run(); + IsolateData* isolate_data() { return isolate_data_.get(); } + // TODO(joyeecheung): align this with the CreateEnvironment exposed in node.h // and the environment creation routine in workers somehow. std::unique_ptr<Environment> CreateMainEnvironment(int* exit_code); @@ -66,6 +81,7 @@ class NodeMainInstance { MultiIsolatePlatform* platform, const std::vector<std::string>& args, const std::vector<std::string>& exec_args); + std::vector<std::string> args_; std::vector<std::string> exec_args_; std::unique_ptr<ArrayBufferAllocator> array_buffer_allocator_; @@ -73,6 +89,7 @@ class NodeMainInstance { MultiIsolatePlatform* platform_; std::unique_ptr<IsolateData> isolate_data_; bool owns_isolate_ = false; + bool deserialize_mode_ = false; }; } // namespace node |