Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ebdf84a
src: make `FreeEnvironment()` perform all necessary cleanup
addaleax Nov 10, 2019
3f9fa28
src: fix memory leak in CreateEnvironment when bootstrap fails
addaleax Nov 11, 2019
459973c
src: move worker_context from Environment to IsolateData
addaleax Nov 12, 2019
2c87b17
src: associate is_main_thread() with worker_context()
addaleax Nov 12, 2019
0e9f4a9
src: align worker and main thread code with embedder API
addaleax Nov 11, 2019
c694f08
src: provide a variant of LoadEnvironment taking a callback
addaleax Nov 13, 2019
8a1255c
src: add LoadEnvironment() variant taking a string
addaleax Nov 19, 2019
bb689cf
test: re-enable cctest that was commented out
addaleax Feb 27, 2020
ad95b85
src: add unique_ptr equivalent of CreatePlatform
addaleax Feb 28, 2020
33ecd3b
src: make InitializeNodeWithArgs() official public API
addaleax Feb 28, 2020
31528f3
src: add ability to look up platform based on `Environment*`
addaleax Feb 28, 2020
eca25d0
src: allow non-Node.js TracingControllers
addaleax Feb 28, 2020
691a575
src: fix what a dispose without checking
Jan 8, 2020
1c5d55a
src: shutdown platform from FreePlatform()
addaleax Feb 28, 2020
a02c5d0
src,test: add full-featured embedder API test
addaleax Feb 28, 2020
0547551
doc: add basic embedding example documentation
addaleax Feb 28, 2020
a7ada43
test: add extended embedder cctest
addaleax Mar 12, 2020
1a8e9ee
test: wait for message from parent in embedding cctest
addaleax Mar 30, 2020
6d231db
embedding: provide hook for custom process.exit() behaviour
addaleax Mar 28, 2020
93a23b9
embedding: make Stop() stop Workers
addaleax Mar 29, 2020
72f42bf
test: use InitializeNodeWithArgs in cctest
addaleax Mar 21, 2020
b931e68
test: use common.buildType in embedding test
addaleax Mar 22, 2020
9aa4cbe
src: initialize inspector before RunBootstrapping()
addaleax Apr 5, 2020
0a2f5e9
worker: unify custom error creation
addaleax Apr 27, 2020
b910fc6
fixup! src: run native immediates during Environment cleanup
addaleax Sep 17, 2020
1ee495d
fixup! test: add extended embedder cctest
addaleax Sep 17, 2020
30b6c2f
fixup! src,test: add full-featured embedder API test
addaleax Sep 17, 2020
6e63159
fixup! doc: add basic embedding example documentation
addaleax Sep 17, 2020
8f464fe
src: make `Environment::interrupt_data_` atomic
addaleax Mar 22, 2020
a74f870
src: fix cleanup hook removal for InspectorTimer
addaleax Mar 27, 2020
a2ebe11
src: use env->RequestInterrupt() for inspector io thread start
addaleax Mar 22, 2020
83015b0
src: use env->RequestInterrupt() for inspector MainThreadInterface
addaleax Mar 22, 2020
2b0315f
src: flush V8 interrupts from Environment dtor
addaleax Mar 28, 2020
aa3e118
src: add callback scope for native immediates
addaleax Jul 14, 2020
c386bd1
fixup! src: add callback scope for native immediates
addaleax Sep 17, 2020
b7f9f3d
fixup! src: align worker and main thread code with embedder API
addaleax Sep 17, 2020
fa4439d
test,doc: add missing uv_setup_args() calls
cjihrig Aug 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: add unique_ptr equivalent of CreatePlatform
This makes this bit of the embedder situation a bit easier to use.

PR-URL: #30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
addaleax committed Sep 23, 2020
commit ad95b853864a3be5e5d26ef0cf5f027634003acb
9 changes: 8 additions & 1 deletion src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,20 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
node::tracing::TracingController* tracing_controller) {
return new NodePlatform(thread_pool_size, tracing_controller);
return MultiIsolatePlatform::Create(thread_pool_size, tracing_controller)
.release();
}

void FreePlatform(MultiIsolatePlatform* platform) {
delete platform;
}

std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
int thread_pool_size,
node::tracing::TracingController* tracing_controller) {
return std::make_unique<NodePlatform>(thread_pool_size, tracing_controller);
}

MaybeLocal<Object> GetPerContextExports(Local<Context> context) {
Isolate* isolate = context->GetIsolate();
EscapableHandleScope handle_scope(isolate);
Expand Down
5 changes: 5 additions & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
virtual void AddIsolateFinishedCallback(v8::Isolate* isolate,
void (*callback)(void*),
void* data) = 0;

static std::unique_ptr<MultiIsolatePlatform> Create(
int thread_pool_size,
node::tracing::TracingController* tracing_controller = nullptr);
};

enum IsolateSettingsFlags {
Expand Down Expand Up @@ -446,6 +450,7 @@ NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local<v8::Context> context);
// it returns nullptr.
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();

// Legacy variants of MultiIsolatePlatform::Create().
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
node::tracing::TracingController* tracing_controller);
Expand Down