Skip to content

Commit ec7b69f

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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent ae81360 commit ec7b69f

18 files changed

+30
-20
lines changed

src/connection_wrap.h

+2-1
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
namespace node {
1110

11+
class Environment;
12+
1213
template <typename WrapType, typename UVType>
1314
class ConnectionWrap : public LibuvStreamWrap {
1415
public:

src/diagnosticfilename-inl.h

+2-2
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
namespace node {
108

9+
class Environment;
10+
1111
inline DiagnosticFilename::DiagnosticFilename(
1212
Environment* env,
1313
const char* prefix,

src/inspector/main_thread_interface.h

-1
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

-1
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
namespace node {

src/js_stream.h

+2-1
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
namespace node {
1211

12+
class Environment;
13+
1314
class JSStream : public AsyncWrap, public StreamBase {
1415
public:
1516
static void Initialize(v8::Local<v8::Object> target,

src/node_crypto_bio.h

+3-1
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
namespace node {
33+
34+
class Environment;
35+
3436
namespace crypto {
3537

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

src/node_dtrace.h

+2-1
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
namespace node {
7877

78+
class Environment;
79+
7980
void InitDTrace(Environment* env);
8081

8182
} // namespace node

src/node_perf.h

+3-1
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
namespace node {
17+
18+
class Environment;
19+
1820
namespace performance {
1921

2022
using v8::FunctionCallbackInfo;

src/node_stat_watcher.h

+2-1
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
namespace node {
3433

34+
class Environment;
35+
3536
class StatWatcher : public HandleWrap {
3637
public:
3738
static void Initialize(Environment* env, v8::Local<v8::Object> target);

src/node_url.h

-1
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

src/pipe_wrap.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626

2727
#include "async_wrap.h"
2828
#include "connection_wrap.h"
29-
#include "env.h"
3029

3130
namespace node {
3231

32+
class Environment;
33+
3334
class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
3435
public:
3536
enum SocketType {

src/req_wrap.h

+2-1
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 "util.h"
98
#include "v8.h"
109

1110
namespace node {
1211

12+
class Environment;
13+
1314
class ReqWrapBase {
1415
public:
1516
explicit inline ReqWrapBase(Environment* env);

src/stream_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6-
#include "env.h"
76
#include "async_wrap-inl.h"
87
#include "node.h"
98
#include "util.h"
@@ -13,6 +12,7 @@
1312
namespace node {
1413

1514
// Forward declarations
15+
class Environment;
1616
class ShutdownWrap;
1717
class WriteWrap;
1818
class StreamBase;

src/stream_wrap.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

2727
#include "stream_base.h"
28-
29-
#include "env.h"
3028
#include "handle_wrap.h"
3129
#include "string_bytes.h"
3230
#include "v8.h"
3331

3432
namespace node {
3533

34+
class Environment;
35+
3636
class LibuvStreamWrap : public HandleWrap, public StreamBase {
3737
public:
3838
static void Initialize(v8::Local<v8::Object> target,

src/tcp_wrap.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

2727
#include "async_wrap.h"
28-
#include "env.h"
2928
#include "connection_wrap.h"
3029

3130
namespace node {
3231

32+
class Environment;
33+
3334
class TCPWrap : public ConnectionWrap<TCPWrap, uv_tcp_t> {
3435
public:
3536
enum SocketType {

src/tls_wrap.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "node_crypto.h" // SSLWrap
2828

2929
#include "async_wrap.h"
30-
#include "env.h"
3130
#include "stream_wrap.h"
3231
#include "v8.h"
3332

@@ -38,6 +37,7 @@
3837
namespace node {
3938

4039
// Forward-declarations
40+
class Environment;
4141
class WriteWrap;
4242
namespace crypto {
4343
class SecureContext;

src/tty_wrap.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424

2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

27-
#include "env.h"
2827
#include "uv.h"
2928
#include "stream_wrap.h"
3029

3130
namespace node {
3231

32+
class Environment;
33+
3334
class TTYWrap : public LibuvStreamWrap {
3435
public:
3536
static void Initialize(v8::Local<v8::Object> target,

src/udp_wrap.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

2727
#include "async_wrap.h"
28-
#include "env.h"
2928
#include "handle_wrap.h"
3029
#include "uv.h"
3130
#include "v8.h"
3231

3332
namespace node {
3433

34+
class Environment;
35+
3536
class UDPWrap: public HandleWrap {
3637
public:
3738
enum SocketType {

0 commit comments

Comments
 (0)