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: https://github.com/nodejs/node/issues/27531

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Alexandre Ferrando authored and Michaël Zasso committed 2019-11-11 10:24:56 +01:00
1 parent a71f210206
commit c52b292adf
18 files changed
+30 -20

No files matched your search

+2 -1
View File
@@ -3,12 +3,13 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "env.h"
#include "stream_wrap.h"
#include "v8.h"
namespace node {
class Environment;
template <typename WrapType, typename UVType>
class ConnectionWrap : public LibuvStreamWrap {
public:
+2 -2
View File
@@ -4,10 +4,10 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "node_internals.h"
#include "env-inl.h"
namespace node {
class Environment;
inline DiagnosticFilename::DiagnosticFilename(
Environment* env,
const char* prefix,
-1
View File
@@ -5,7 +5,6 @@
#error("This header can only be used when inspector is enabled")
#endif
#include "env.h"
#include "inspector_agent.h"
#include "node_mutex.h"
-1
View File
@@ -7,7 +7,6 @@
#error("This header can only be used when inspector is enabled")
#endif
#include "env.h"
#include "inspector_agent.h"
namespace node {
+2 -1
View File
@@ -4,12 +4,13 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "async_wrap.h"
#include "env.h"
#include "stream_base.h"
#include "v8.h"
namespace node {
class Environment;
class JSStream : public AsyncWrap, public StreamBase {
public:
static void Initialize(v8::Local<v8::Object> target,
+3 -1
View File
@@ -26,11 +26,13 @@
#include "node_crypto.h"
#include "openssl/bio.h"
#include "env.h"
#include "util.h"
#include "v8.h"
namespace node {
class Environment;
namespace crypto {
// This class represents buffers for OpenSSL I/O, implemented as a singly-linked
+2 -1
View File
@@ -24,7 +24,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "env.h"
#include "v8.h"
extern "C" {
@@ -76,6 +75,8 @@ typedef struct {
namespace node {
class Environment;
void InitDTrace(Environment* env);
} // namespace node
+3 -1
View File
@@ -5,7 +5,6 @@
#include "node.h"
#include "node_perf_common.h"
#include "env.h"
#include "base_object-inl.h"
#include "histogram-inl.h"
@@ -15,6 +14,9 @@
#include <string>
namespace node {
class Environment;
namespace performance {
using v8::FunctionCallbackInfo;
+2 -1
View File
@@ -26,12 +26,13 @@
#include "node.h"
#include "handle_wrap.h"
#include "env.h"
#include "uv.h"
#include "v8.h"
namespace node {
class Environment;
class StatWatcher : public HandleWrap {
public:
static void Initialize(Environment* env, v8::Local<v8::Object> target);
-1
View File
@@ -4,7 +4,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "node.h"
#include "env.h"
#include <string>
+2 -1
View File
@@ -26,10 +26,11 @@
#include "async_wrap.h"
#include "connection_wrap.h"
#include "env.h"
namespace node {
class Environment;
class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
public:
enum SocketType {
+2 -1
View File
@@ -4,12 +4,13 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "async_wrap.h"
#include "env.h"
#include "util.h"
#include "v8.h"
namespace node {
class Environment;
class ReqWrapBase {
public:
explicit inline ReqWrapBase(Environment* env);
+1 -1
View File
@@ -3,7 +3,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "env.h"
#include "async_wrap-inl.h"
#include "node.h"
#include "util.h"
@@ -13,6 +12,7 @@
namespace node {
// Forward declarations
class Environment;
class ShutdownWrap;
class WriteWrap;
class StreamBase;
+2 -2
View File
@@ -25,14 +25,14 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "stream_base.h"
#include "env.h"
#include "handle_wrap.h"
#include "string_bytes.h"
#include "v8.h"
namespace node {
class Environment;
class LibuvStreamWrap : public HandleWrap, public StreamBase {
public:
static void Initialize(v8::Local<v8::Object> target,
+2 -1
View File
@@ -25,11 +25,12 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "async_wrap.h"
#include "env.h"
#include "connection_wrap.h"
namespace node {
class Environment;
class TCPWrap : public ConnectionWrap<TCPWrap, uv_tcp_t> {
public:
enum SocketType {
+1 -1
View File
@@ -27,7 +27,6 @@
#include "node_crypto.h" // SSLWrap
#include "async_wrap.h"
#include "env.h"
#include "stream_wrap.h"
#include "v8.h"
@@ -38,6 +37,7 @@
namespace node {
// Forward-declarations
class Environment;
class WriteWrap;
namespace crypto {
class SecureContext;
+2 -1
View File
@@ -24,12 +24,13 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "env.h"
#include "uv.h"
#include "stream_wrap.h"
namespace node {
class Environment;
class TTYWrap : public LibuvStreamWrap {
public:
static void Initialize(v8::Local<v8::Object> target,
+2 -1
View File
@@ -25,13 +25,14 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "async_wrap.h"
#include "env.h"
#include "handle_wrap.h"
#include "uv.h"
#include "v8.h"
namespace node {
class Environment;
class UDPWrap: public HandleWrap {
public:
enum SocketType {