Commit 972bfe1
n-api: Sync with back-compat changes
Background: To enable N-API support for node versions back to v4, the
N-API code can also be built as an external addon. To make maintenance
easier, a single codebase needs to support both built-in and external
scenarios, along with Node versions >= 4 (and corresponding V8
versions).
This change includes several minor fixes to avoid using node
internal APIs and support older V8 versions:
- Expand node::arraysize
- In the CHECK_ENV() macro, return an error code instead of calling
node::FatalError(). This is more consistent with how other invalid
arguments to N-API functions are handled.
- In v8impl::SetterCallbackWrapper::SetReturnValue(), do nothing
instead of calling node::FatalError(). This is more consistent
with JavaScript setter callbacks, where any returned value is
silently ignored.
- When queueing async work items, get the uv default loop instead of
getting the loop from node::Environment::GetCurrent(). Currently
that returns the same loop anyway. If/when node supports multiple
environments, it should have a public API for getting the
environment & event loop, and we can update this implementation
then.
- Use v8::Maybe::FromJust() instead of the newer alias ToChecked()
PR-URL: #12674
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>1 parent a4fd9e5 commit 972bfe1
1 file changed
+16
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | | - | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
578 | 579 | | |
579 | 580 | | |
580 | 581 | | |
581 | | - | |
582 | | - | |
| 582 | + | |
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
| |||
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
747 | | - | |
| 747 | + | |
| 748 | + | |
748 | 749 | | |
749 | 750 | | |
750 | 751 | | |
| |||
1696 | 1697 | | |
1697 | 1698 | | |
1698 | 1699 | | |
1699 | | - | |
| 1700 | + | |
1700 | 1701 | | |
1701 | 1702 | | |
1702 | 1703 | | |
| |||
1715 | 1716 | | |
1716 | 1717 | | |
1717 | 1718 | | |
1718 | | - | |
| 1719 | + | |
1719 | 1720 | | |
1720 | 1721 | | |
1721 | 1722 | | |
| |||
1740 | 1741 | | |
1741 | 1742 | | |
1742 | 1743 | | |
1743 | | - | |
| 1744 | + | |
1744 | 1745 | | |
1745 | 1746 | | |
1746 | 1747 | | |
| |||
2821 | 2822 | | |
2822 | 2823 | | |
2823 | 2824 | | |
2824 | | - | |
2825 | | - | |
2826 | | - | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
2827 | 2830 | | |
2828 | 2831 | | |
2829 | 2832 | | |
| |||
0 commit comments