Commit 9169449
committed
src: refactor WriteWrap and ShutdownWraps
Encapsulate stream requests more:
- `WriteWrap` and `ShutdownWrap` classes are now tailored to the
streams on which they are used. In particular, for most streams
these are now plain `AsyncWrap`s and do not carry the overhead
of unused libuv request data.
- Provide generic `Write()` and `Shutdown()` methods that wrap
around the actual implementations, and make *usage* of streams
easier, rather than implementing; for example, wrap objects
don’t need to be provided by callers anymore.
- Use `EmitAfterWrite()` and `EmitAfterShutdown()` handlers to
call the corresponding JS handlers, rather than always trying
to call them. This makes usage of streams by other C++ code
easier and leaner.
Also fix up some tests that were previously not actually testing
asynchronicity when the comments indicated that they would.
PR-URL: #18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 3543c55 commit 9169449Copy full SHA for 9169449
File tree
Expand file treeCollapse file tree
20 files changed
+556
-427
lines changedOpen diff view settings
Filter options
- benchmark/net
- lib
- internal
- http2
- src
- test/parallel
Expand file treeCollapse file tree
20 files changed
+556
-427
lines changedOpen diff view settings
Collapse file
benchmark/net/tcp-raw-c2s.js
Copy file name to clipboardExpand all lines: benchmark/net/tcp-raw-c2s.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
118 | 118 | |
119 | 119 | |
120 | 120 | |
121 | | - |
| 121 | + |
122 | 122 | |
123 | 123 | |
124 | 124 | |
|
Collapse file
benchmark/net/tcp-raw-pipe.js
Copy file name to clipboardExpand all lines: benchmark/net/tcp-raw-pipe.js+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | | - |
| 54 | + |
55 | 55 | |
56 | 56 | |
57 | 57 | |
| ||
130 | 130 | |
131 | 131 | |
132 | 132 | |
133 | | - |
| 133 | + |
134 | 134 | |
135 | 135 | |
136 | 136 | |
|
Collapse file
benchmark/net/tcp-raw-s2c.js
Copy file name to clipboardExpand all lines: benchmark/net/tcp-raw-s2c.js+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
74 | 74 | |
75 | 75 | |
76 | 76 | |
77 | | - |
| 77 | + |
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | 81 | |
82 | | - |
83 | | - |
84 | | - |
| 82 | + |
| 83 | + |
| 84 | + |
85 | 85 | |
86 | 86 | |
87 | 87 | |
|
Collapse file
+4-5Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1396 | 1396 | |
1397 | 1397 | |
1398 | 1398 | |
1399 | | - |
| 1399 | + |
1400 | 1400 | |
1401 | 1401 | |
1402 | 1402 | |
1403 | 1403 | |
1404 | 1404 | |
1405 | | - |
| 1405 | + |
1406 | 1406 | |
1407 | 1407 | |
1408 | 1408 | |
1409 | 1409 | |
1410 | | - |
1411 | | - |
1412 | | - |
| 1410 | + |
| 1411 | + |
1413 | 1412 | |
1414 | 1413 | |
1415 | 1414 | |
|
Collapse file
lib/internal/wrap_js_stream.js
Copy file name to clipboardExpand all lines: lib/internal/wrap_js_stream.js+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
115 | 115 | |
116 | 116 | |
117 | 117 | |
118 | | - |
119 | | - |
120 | | - |
| 118 | + |
| 119 | + |
| 120 | + |
121 | 121 | |
122 | 122 | |
123 | 123 | |
|
Collapse file
+7-7Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
323 | 323 | |
324 | 324 | |
325 | 325 | |
326 | | - |
| 326 | + |
327 | 327 | |
328 | 328 | |
329 | 329 | |
| ||
842 | 842 | |
843 | 843 | |
844 | 844 | |
845 | | - |
| 845 | + |
846 | 846 | |
847 | 847 | |
848 | 848 | |
849 | 849 | |
850 | | - |
| 850 | + |
851 | 851 | |
852 | 852 | |
853 | 853 | |
| ||
857 | 857 | |
858 | 858 | |
859 | 859 | |
860 | | - |
| 860 | + |
861 | 861 | |
862 | | - |
| 862 | + |
863 | 863 | |
864 | 864 | |
865 | 865 | |
| ||
868 | 868 | |
869 | 869 | |
870 | 870 | |
871 | | - |
872 | | - |
| 871 | + |
| 872 | + |
873 | 873 | |
874 | 874 | |
875 | 875 | |
|
Collapse file
+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
303 | 303 | |
304 | 304 | |
305 | 305 | |
| 306 | + |
306 | 307 | |
307 | 308 | |
308 | 309 | |
|
Collapse file
+1-6Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | | - |
95 | | - |
96 | 94 | |
97 | 95 | |
98 | 96 | |
| ||
127 | 125 | |
128 | 126 | |
129 | 127 | |
130 | | - |
131 | | - |
132 | 128 | |
133 | 129 | |
134 | 130 | |
| ||
154 | 150 | |
155 | 151 | |
156 | 152 | |
157 | | - |
158 | 153 | |
159 | | - |
| 154 | + |
160 | 155 | |
161 | 156 | |
162 | 157 | |
|
Collapse file
+10-34Lines changed: 10 additions & 34 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1552 | 1552 | |
1553 | 1553 | |
1554 | 1554 | |
1555 | | - |
1556 | | - |
1557 | | - |
1558 | | - |
1559 | | - |
1560 | | - |
1561 | | - |
1562 | | - |
1563 | | - |
1564 | | - |
1565 | | - |
1566 | | - |
| 1555 | + |
| 1556 | + |
| 1557 | + |
1567 | 1558 | |
1568 | 1559 | |
1569 | 1560 | |
| ||
1649 | 1640 | |
1650 | 1641 | |
1651 | 1642 | |
1652 | | - |
1653 | | - |
1654 | | - |
1655 | | - |
1656 | | - |
1657 | | - |
1658 | | - |
1659 | | - |
1660 | | - |
1661 | 1643 | |
1662 | 1644 | |
1663 | 1645 | |
| ||
1833 | 1815 | |
1834 | 1816 | |
1835 | 1817 | |
1836 | | - |
1837 | | - |
1838 | | - |
1839 | | - |
1840 | | - |
1841 | | - |
1842 | | - |
1843 | | - |
1844 | | - |
1845 | | - |
1846 | 1818 | |
1847 | 1819 | |
1848 | | - |
1849 | | - |
| 1820 | + |
| 1821 | + |
| 1822 | + |
| 1823 | + |
| 1824 | + |
| 1825 | + |
| 1826 | + |
1850 | 1827 | |
1851 | 1828 | |
1852 | 1829 | |
| ||
2038 | 2015 | |
2039 | 2016 | |
2040 | 2017 | |
2041 | | - |
2042 | 2018 | |
2043 | 2019 | |
2044 | 2020 | |
|
Collapse file
+4-5Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
605 | 605 | |
606 | 606 | |
607 | 607 | |
608 | | - |
609 | | - |
610 | | - |
611 | 608 | |
612 | 609 | |
613 | 610 | |
| ||
822 | 819 | |
823 | 820 | |
824 | 821 | |
| 822 | + |
| 823 | + |
| 824 | + |
| 825 | + |
825 | 826 | |
826 | 827 | |
827 | 828 | |
| ||
911 | 912 | |
912 | 913 | |
913 | 914 | |
914 | | - |
915 | | - |
916 | 915 | |
917 | 916 | |
918 | 917 | |
|
0 commit comments