Skip to content
Permalink
Browse files

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>
  • Loading branch information
alferpal authored and targos committed Oct 26, 2019
1 parent a71f210 commit c52b292adfbd3eb9537bcee21412dc97190d4ef1
@@ -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:
@@ -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,
@@ -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"

@@ -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 {
@@ -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,
@@ -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
@@ -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
@@ -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;
@@ -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);
@@ -4,7 +4,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node.h"
#include "env.h"

#include <string>

@@ -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 {
@@ -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);
@@ -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;
@@ -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,
@@ -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 {
@@ -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;
@@ -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,
@@ -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 {

0 comments on commit c52b292

Please sign in to comment.
You can’t perform that action at this time.