Skip to content

Commit c52b292

Browse files
alferpaltargos
authored andcommitted
src: change env.h includes for forward declarations
Due to how the Environment class is used through the codebase, there are a lot of includes referencing either env.h or env-inl.h. This can cause that when any development touches those libraries, a lot of files have to be recompiled. This commit attempts to change those includes by forward declarations when possible to mitigate the issue. Refs: #27531 PR-URL: #30133 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent a71f210 commit c52b292

18 files changed

Lines changed: 30 additions & 20 deletions

‎src/connection_wrap.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6-
#include"env.h"
76
#include"stream_wrap.h"
87
#include"v8.h"
98

109
namespacenode {
1110

11+
classEnvironment;
12+
1213
template <typename WrapType, typename UVType>
1314
classConnectionWrap : publicLibuvStreamWrap {
1415
public:

‎src/diagnosticfilename-inl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

66
#include"node_internals.h"
7-
#include"env-inl.h"
8-
97
namespacenode {
108

9+
classEnvironment;
10+
1111
inlineDiagnosticFilename::DiagnosticFilename(
1212
Environment* env,
1313
constchar* prefix,

‎src/inspector/main_thread_interface.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#error("This header can only be used when inspector is enabled")
66
#endif
77

8-
#include"env.h"
98
#include"inspector_agent.h"
109
#include"node_mutex.h"
1110

‎src/inspector_profiler.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#error("This header can only be used when inspector is enabled")
88
#endif
99

10-
#include"env.h"
1110
#include"inspector_agent.h"
1211

1312
namespacenode {

‎src/js_stream.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

66
#include"async_wrap.h"
7-
#include"env.h"
87
#include"stream_base.h"
98
#include"v8.h"
109

1110
namespacenode {
1211

12+
classEnvironment;
13+
1314
classJSStream : publicAsyncWrap, publicStreamBase {
1415
public:
1516
staticvoidInitialize(v8::Local<v8::Object> target,

‎src/node_crypto_bio.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626

2727
#include"node_crypto.h"
2828
#include"openssl/bio.h"
29-
#include"env.h"
3029
#include"util.h"
3130
#include"v8.h"
3231

3332
namespacenode {
33+
34+
classEnvironment;
35+
3436
namespacecrypto {
3537

3638
// This class represents buffers for OpenSSL I/O, implemented as a singly-linked

‎src/node_dtrace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

27-
#include"env.h"
2827
#include"v8.h"
2928

3029
extern"C" {
@@ -76,6 +75,8 @@ typedef struct {
7675

7776
namespacenode {
7877

78+
classEnvironment;
79+
7980
voidInitDTrace(Environment* env);
8081

8182
} // namespace node

‎src/node_perf.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include"node.h"
77
#include"node_perf_common.h"
8-
#include"env.h"
98
#include"base_object-inl.h"
109
#include"histogram-inl.h"
1110

@@ -15,6 +14,9 @@
1514
#include<string>
1615

1716
namespacenode {
17+
18+
classEnvironment;
19+
1820
namespaceperformance {
1921

2022
using v8::FunctionCallbackInfo;

‎src/node_stat_watcher.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626

2727
#include"node.h"
2828
#include"handle_wrap.h"
29-
#include"env.h"
3029
#include"uv.h"
3130
#include"v8.h"
3231

3332
namespacenode {
3433

34+
classEnvironment;
35+
3536
classStatWatcher : publicHandleWrap {
3637
public:
3738
staticvoidInitialize(Environment* env, v8::Local<v8::Object> target);

‎src/node_url.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

66
#include"node.h"
7-
#include"env.h"
87

98
#include<string>
109

0 commit comments

Comments
 (0)