summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2018-07-03 09:37:07 +0200
committerMichaƫl Zasso <targos@protonmail.com>2018-09-07 21:07:29 +0200
commit90ae4bd0c987479ff364a469e6f2fcc83baba66c (patch)
treefdbc96f5b8a8aa53e240515a2f7d3f1f6e242fd6 /src
parentd5e72944457117913c7ded2caf1f623a25f8726f (diff)
downloadandroid-node-v8-90ae4bd0c987479ff364a469e6f2fcc83baba66c.tar.gz
android-node-v8-90ae4bd0c987479ff364a469e6f2fcc83baba66c.tar.bz2
android-node-v8-90ae4bd0c987479ff364a469e6f2fcc83baba66c.zip
src: add InitializeV8Platform function
This commit adds an InitializeV8Platform function which calls v8_platform's Initialize to create the NodePlatform and also set the structs members. When running cctests this functions was not being called (it is called from the Start function but that function is not called by the test fixture. The motivation for adding this is that I'm guessing that embedders would might need the ability to do the same thing. Refs: https://github.com/nodejs/node-v8/issues/69 PR-URL: https://github.com/nodejs/node/pull/21983 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc9
-rw-r--r--src/node.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc
index 68f2388879..89e4f76cac 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -2990,6 +2990,12 @@ MultiIsolatePlatform* CreatePlatform(
}
+MultiIsolatePlatform* InitializeV8Platform(int thread_pool_size) {
+ v8_platform.Initialize(thread_pool_size);
+ return v8_platform.Platform();
+}
+
+
void FreePlatform(MultiIsolatePlatform* platform) {
delete platform;
}
@@ -3209,8 +3215,7 @@ int Start(int argc, char** argv) {
V8::SetEntropySource(crypto::EntropySource);
#endif // HAVE_OPENSSL
- v8_platform.Initialize(
- per_process_opts->v8_thread_pool_size);
+ InitializeV8Platform(per_process_opts->v8_thread_pool_size);
V8::Initialize();
performance::performance_v8_start = PERFORMANCE_NOW();
v8_initialized = true;
diff --git a/src/node.h b/src/node.h
index 8bd4bd1549..9b4dfa6e14 100644
--- a/src/node.h
+++ b/src/node.h
@@ -291,6 +291,7 @@ NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller);
+MultiIsolatePlatform* InitializeV8Platform(int thread_pool_size);
NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform);
NODE_EXTERN void EmitBeforeExit(Environment* env);