Anna Henningsen
2a885151e9
src: include AsyncWrap provider strings in snapshot
...
… and move them to `IsolateData`, because they should exist once
per Isolate.
PR-URL: https://github.com/nodejs/node/pull/32572
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-04-02 17:45:41 +02:00
Anna Henningsen
72e521f5e8
src: move JSONWriter into its own file
...
The JSONWriter feature is not inherently related to the report
feature in any way.
As a drive-by fix, remove a number of unused header includes.
PR-URL: https://github.com/nodejs/node/pull/32552
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2020-04-02 17:25:57 +02:00
Anna Henningsen
c4b381a131
src: align PerformanceState class name with conventions
...
Class names are written in UpperCamelCase. Otherwise, this looks like
it’s a variable, not a class name.
PR-URL: https://github.com/nodejs/node/pull/32539
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-04-02 17:25:29 +02:00
Anna Henningsen
037ac99ed5
embedding: make Stop() stop Workers
...
This makes sense given that terminating execution of the parent thread
this way likely also is supposed to stop all running Worker threads
spawned by it.
PR-URL: https://github.com/nodejs/node/pull/32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-04-02 17:23:19 +02:00
Anna Henningsen
d812f16234
embedding: provide hook for custom process.exit() behaviour
...
Embedders may not want to terminate the process when `process.exit()`
is called. This provides a hook for more flexible handling of that
situation.
Refs: https://github.com/nodejs/node/pull/30467#issuecomment-603689644
PR-URL: https://github.com/nodejs/node/pull/32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-04-02 17:23:15 +02:00
Alex R
b149eefa82
http: fix incorrect headersTimeout measurement
...
For keep-alive connections, the headersTimeout may fire during
subsequent request because the measurement was reset after
a request and not before a request.
PR-URL: https://github.com/nodejs/node/pull/32329
Fixes: https://github.com/nodejs/node/issues/27363
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-04-02 14:50:20 +02:00
Anna Henningsen
8b9e877435
worker: do not emit 'exit' events during process.exit()
...
Do not emit `'exit'` events caused by recursively stopping all
running Workers from inside the `process.exit()` call.
PR-URL: https://github.com/nodejs/node/pull/32546
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-04-02 02:46:14 +02:00
Anna Henningsen
d3a4865417
tracing: do not attempt to call into JS when disallowed
...
PR-URL: https://github.com/nodejs/node/pull/32548
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-04-02 02:45:16 +02:00
cjihrig
60c4c2b6c5
src: runtime deprecate process.umask()
...
This commit runtime deprecates calling process.umask() with
no arguments.
PR-URL: https://github.com/nodejs/node/pull/32499
Fixes: https://github.com/nodejs/node/issues/32321
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-31 22:05:07 -04:00
Sam Roberts
867ff41d87
src: handle report options on fatalerror
...
Follow on to https://github.com/nodejs/node/pull/32207 , 3 other options
are also not respected under situations that the isolate is not
available.
PR-URL: https://github.com/nodejs/node/pull/32497
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-03-31 11:59:25 -07:00
James M Snell
accc984ca9
src: refactoring and cleanup of node_i18n
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/32438
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2020-03-30 09:50:25 -07:00
murgatroid99
18c3ff99aa
dns: add dns.ALL hints flag constant
...
PR-URL: https://github.com/nodejs/node/pull/32183
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 17:21:13 +02:00
Ben Noordhuis
c37d4ccee8
crypto: clear openssl error stack after en/decrypt
...
The publicEncrypt/privateDecrypt/etc. family of functions didn't clear
OpenSSL's error stack on early return.
Notably, trying to use an encrypted key with the wrong passphrase left
an error on the stack that made subsequent encrypt or decrypt operations
fail, even with an unencrypted key.
Fixes: https://github.com/nodejs/node/issues/32240
PR-URL: https://github.com/nodejs/node/pull/32248
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-03-30 17:13:45 +02:00
himself65
2d8812984f
src: remove unnecessary 'Local.As' operation
...
PR-URL: https://github.com/nodejs/node/pull/32286
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 17:12:31 +02:00
Harshitha KP
b6459ec490
worker: runtime error on pthread creation
...
With large number of worker threads pthread
fails with hard assertion.
Instead of hard assertion throw a runtime error.
PR-URL: https://github.com/nodejs/node/pull/32344
Fixes: https://github.com/nodejs/node/issues/32319
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 10:27:35 +02:00
Sk Sajidul Kadir
97ef4d76c9
fs: add fs.readv()
...
Fixes: https://github.com/nodejs/node/issues/2298
PR-URL: https://github.com/nodejs/node/pull/32356
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 10:18:58 +02:00
Christian Niederer
8245a7816c
src: check for overflow when extending AliasedBufferBase
...
When resizing an aliased_buffer check if the new size will overflow.
PR-URL: https://github.com/nodejs/node/pull/31740
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-03-30 10:14:52 +02:00
Gabriel Schulhof
67d5c907d2
src: unify Linux and FreeBSD large pages implem
...
dl_iterate_phdr(3) is also available for FreeBSD. This change adds the
same trimming code for the start and end of the .text section as on
Linux, making it work on FreeBSD, and removing the need for the
additional FreeBSD-specific check.
Manually tested on
* https://www.osboxes.org/freebsd/#freebsd-12-1-vbox
* https://www.osboxes.org/freebsd/#freebsd-11-vbox
* test-digitalocean-freebsd11-x64-2
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com >
PR-URL: https://github.com/nodejs/node/pull/32534
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
2020-03-29 22:55:20 -07:00
Harshitha KP
768b0f54eb
src: replace handle dereference with ContainerOf
...
this was influenced by https://github.com/nodejs/node/pull/32269
PR-URL: https://github.com/nodejs/node/pull/32298
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 00:42:44 +02:00
Juan José Arboleda
effebf87ab
src: remove unused v8 namespace
...
PR-URL: https://github.com/nodejs/node/pull/32375
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-30 00:08:38 +02:00
Syohei YOSHIDA
3822cae39c
doc: fix profile type of --heap-prof-name
...
V8 CPU profile -> V8 heap profile
PR-URL: https://github.com/nodejs/node/pull/32404
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-29 22:56:31 +02:00
himself65
a2463124da
src: enhance template function 'MakeUtf8String'
...
PR-URL: https://github.com/nodejs/node/pull/32322
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2020-03-29 22:42:19 +02:00
unknown
400bc5cdc0
http: increase default header size from 8KB to 16KB
...
Fixes: https://github.com/nodejs/node/issues/27645
PR-URL: https://github.com/nodejs/node/pull/32520
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2020-03-29 22:38:57 +02:00
Daniel Bevenius
cd1db2db48
src: fix compiler warnings in node_report_module
...
Currently, the following compiler warnings are generated:
../src/node_report_module.cc:
In function ‘void report::ShouldReportOnFatalError(
const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_report_module.cc:132:16: warning:
unused variable ‘env’ [-Wunused-variable]
132 | Environment* env = Environment::GetCurrent(info);
| ^~~
../src/node_report_module.cc:
In function ‘void report::SetReportOnFatalError(
const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_report_module.cc:138:16: warning:
unused variable ‘env’ [-Wunused-variable]
138 | Environment* env = Environment::GetCurrent(info);
| ^~~
This commit removes the unused variables.
PR-URL: https://github.com/nodejs/node/pull/32498
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-28 14:41:14 +01:00
himself65
a744dad589
src: remove excess v8 namespace
...
PR-URL: https://github.com/nodejs/node/pull/32191
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-28 14:34:35 +01:00
Gabriel Schulhof and Ben Noordhuis
fa3fd78c88
src: simplify large pages mapping code
...
* Introduce `OnScopeLeave` handler for cleaning up mmap()ed range(s).
* Factor out failure scenario at the bottom of the function with
`fail` label for use with `goto`.
* Do not allocate temporary range (`nmem`) on FreeBSD, because it is
not used.
The intention is that the steps involved in re-mapping to large pages
become more clearly visible.
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com >
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl >
PR-URL: https://github.com/nodejs/node/pull/32396
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: David Carlier <devnexen@gmail.com >
2020-03-27 19:44:40 -07:00
Juan José Arboleda
6791ac0a47
src: clean v8 namespaces in env.cc file
...
PR-URL: https://github.com/nodejs/node/pull/32374
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-03-27 17:28:51 +01:00
Xavier Stouder
191fb3c2f2
src: check for empty maybe local
...
Using ToLocalChecked on MaybeLocal without verifying it's empty
can lead to unattempted crash.
PR-URL: https://github.com/nodejs/node/pull/32339
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-27 17:25:32 +01:00
Anna Henningsen
1b1c2993a5
src: cleanup DestroyParam when Environment exits
...
Otherwise, this leaks memory if the weak callback is never called.
PR-URL: https://github.com/nodejs/node/pull/32421
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-27 16:04:44 +01:00
himself65
dade90db9c
src: enhance C++ sprintf utility
...
PR-URL: https://github.com/nodejs/node/pull/32385
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com >
2020-03-25 19:46:11 -07:00
Anna Henningsen
b950daf836
src: use single ObjectTemplate for TextDecoder
...
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.
Fixes: https://github.com/nodejs/node/issues/32424
PR-URL: https://github.com/nodejs/node/pull/32426
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2020-03-26 02:37:46 +00:00
Harshitha KP and Shobhit Chittora schittora@paypal.com
2fa74e3e38
report: handle on-fatalerror better
...
--report-on-fatalerror was not honored properly, as there was no
way to check the value which was stored in the Environment pointer
which can be inaccessible under certain fatal error situations.
Move the flag out of Environment pointer so that this is doable.
Co-authored-by: Shobhit Chittora schittora@paypal.com
PR-URL: https://github.com/nodejs/node/pull/32207
Fixes: https://github.com/nodejs/node/issues/31576
Refs: https://github.com/nodejs/node/pull/29881
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2020-03-25 12:43:45 -07:00
Anna Henningsen
668bc11c1b
src: delete BaseObjectWeakPtr data when pointee is gone
...
Fix the condition for deleting the underlying data pointed to by
a `BaseObjectWeakPtr`, which erroneously skipped that deletion
when `ptr->get()` was `nullptr`. This fixes a memory leak reported
by some of the tests.
Refs: https://github.com/nodejs/node/pull/30374#issuecomment-601848973
PR-URL: https://github.com/nodejs/node/pull/32393
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-03-23 12:06:24 -07:00
Anna Henningsen
f2b0fb270d
src: simplify IsolateData shortcut accesses
...
PR-URL: https://github.com/nodejs/node/pull/32407
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
2020-03-23 11:04:11 -07:00
Anna Henningsen
678e1be6aa
src: delete CallbackInfo when cleared from cleanup hook
...
Fixes: https://github.com/nodejs/node/issues/32400
PR-URL: https://github.com/nodejs/node/pull/32405
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-23 11:02:04 -07:00
Michaël Zasso
d23eed256b
src: remove calls to deprecated ArrayBuffer methods
...
v8::ArrayBuffer::IsExternal and v8::ArrayBuffer::Externalize are
no longer necessary.
PR-URL: https://github.com/nodejs/node/pull/32358
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2020-03-21 12:00:57 +01:00
Anna Henningsen
43d32b073f
src,test: add full-featured embedder API test
...
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:58:23 +01:00
Anna Henningsen
a8cf886de7
src: shutdown platform from FreePlatform()
...
There is currently no way to properly do this.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:58:19 +01:00
Jichan and Anna Henningsen
0e576740dc
src: fix what a dispose without checking
...
If created platform with CreatePlatform, the crash occurs because
it does not check if it was initialized to v8_platform
when DisposePlatform was called.
Refs: https://github.com/nodejs/node/pull/31260
Co-authored-by: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:45 +01:00
Anna Henningsen
887b6a143b
src: allow non-Node.js TracingControllers
...
We do not need a Node.js-provided `v8::TracingController`, generally.
Loosen that restriction in order to make it easier for embedders
to provide their own subclass of `v8::TracingController`,
or none at all.
Refs: https://github.com/electron/electron/commit/9c36576dddfaecde1298ff3e089d21a6e54fe67f
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:40 +01:00
Anna Henningsen
7e0264d932
src: add ability to look up platform based on Environment*
...
This should eventually remove any necessity to use the global-state
`GetMainThreadMultiIsolatePlatform()`.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:38 +01:00
Anna Henningsen
d7f11077f1
src: make InitializeNodeWithArgs() official public API
...
This is a decent replacement for the to-be-deprecated Init() API.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:34 +01:00
Anna Henningsen
821e21de8c
src: add unique_ptr equivalent of CreatePlatform
...
This makes this bit of the embedder situation a bit easier to use.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:31 +01:00
Anna Henningsen
7dead8440c
src: add LoadEnvironment() variant taking a string
...
Allow passing a string as the main module rather than using
the callback variant.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:26 +01:00
Anna Henningsen
c44edec4da
src: provide a variant of LoadEnvironment taking a callback
...
This allows embedders to flexibly control how they start JS code
rather than using `third_party_main`.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:23 +01:00
Anna Henningsen
a9fb51f9be
src: align worker and main thread code with embedder API
...
This addresses some long-standing TODOs by Joyee and me about
making the embedder API more powerful and us less reliant on
internal APIs for creating the main thread and Workers.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:20 +01:00
Anna Henningsen
084c379648
src: associate is_main_thread() with worker_context()
...
In our codebase, the assumption generally is that `!is_main_thread()`
means that the current Environment belongs to a Node.js Worker thread.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:17 +01:00
Anna Henningsen
64c01222d9
src: move worker_context from Environment to IsolateData
...
Workers are fully in control of their Isolates, and this helps
avoid a problem with later changes to `CreateEnvironment()`
because now we can run the boostrapping code inside the latter.
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:15 +01:00
Anna Henningsen
288382a4ce
src: fix memory leak in CreateEnvironment when bootstrap fails
...
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:12 +01:00
Anna Henningsen
d7bc5816a5
src: make FreeEnvironment() perform all necessary cleanup
...
Make the calls `stop_sub_worker_contexts()`, `RunCleanup()`
part of the public API for easier embedding.
(Note that calling `RunAtExit()` is idempotent because the
at-exit callback queue is cleared after each call.)
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-03-21 10:57:08 +01:00