From 22d7048a87f6e8d48307bfc227e2998a688e8424 Mon Sep 17 00:00:00 2001 From: Arpan Sarkar Date: Mon, 27 May 2019 22:56:46 +0530 Subject: [PATCH] src: reduced env.h and env-inl.h include lines and added forward declarations of class Environment where necessary. --- src/api/async_resource.cc | 3 ++- src/api/callback.cc | 2 +- src/api/exceptions.cc | 2 +- src/api/hooks.cc | 2 +- src/async_wrap.cc | 3 ++- src/cares_wrap.cc | 2 +- src/connect_wrap.cc | 2 +- src/connection_wrap.cc | 2 +- src/fs_event_wrap.cc | 3 +-- src/handle_wrap.cc | 2 +- src/heap_utils.cc | 2 +- src/inspector/tracing_agent.cc | 1 + src/js_stream.cc | 2 +- src/node_buffer.cc | 2 +- src/node_crypto.cc | 3 ++- src/node_crypto_bio.h | 2 +- src/node_http_parser_impl.h | 3 +-- src/node_i18n.cc | 1 + src/node_platform.cc | 2 +- src/node_process_methods.cc | 2 +- src/node_process_object.cc | 2 +- src/node_task_queue.cc | 2 +- src/node_url.h | 3 +-- src/node_v8_platform-inl.h | 2 +- src/node_zlib.cc | 2 +- src/pipe_wrap.cc | 2 +- src/process_wrap.cc | 2 +- src/req_wrap-inl.h | 1 + src/signal_wrap.cc | 2 +- src/spawn_sync.cc | 3 +-- src/stream_base-inl.h | 2 +- src/stream_base.cc | 2 +- src/stream_wrap.cc | 3 +-- src/string_bytes.cc | 2 +- src/tcp_wrap.cc | 3 +-- src/tracing/agent.cc | 2 +- src/tty_wrap.cc | 2 +- src/udp_wrap.cc | 2 +- 38 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/api/async_resource.cc b/src/api/async_resource.cc index 5141c7c6b35abd..d207be92343b84 100644 --- a/src/api/async_resource.cc +++ b/src/api/async_resource.cc @@ -1,6 +1,7 @@ #include "node.h" -#include "env-inl.h" + +class Environment; namespace node { using v8::Function; diff --git a/src/api/callback.cc b/src/api/callback.cc index 52a8da35b671d1..56226b387c78b5 100644 --- a/src/api/callback.cc +++ b/src/api/callback.cc @@ -1,8 +1,8 @@ #include "node.h" #include "async_wrap-inl.h" -#include "env-inl.h" #include "v8.h" +class Environment; namespace node { using v8::Context; diff --git a/src/api/exceptions.cc b/src/api/exceptions.cc index ee5ea984eb23c5..44a2f55683c4ae 100644 --- a/src/api/exceptions.cc +++ b/src/api/exceptions.cc @@ -1,6 +1,5 @@ // This file contains implementation of error APIs exposed in node.h -#include "env-inl.h" #include "node.h" #include "node_errors.h" #include "util-inl.h" @@ -9,6 +8,7 @@ #include +class Environment; namespace node { using v8::Exception; diff --git a/src/api/hooks.cc b/src/api/hooks.cc index cec58cee00847c..a4e54bd19b95cf 100644 --- a/src/api/hooks.cc +++ b/src/api/hooks.cc @@ -1,8 +1,8 @@ -#include "env-inl.h" #include "node_internals.h" #include "node_process.h" #include "async_wrap.h" +class Environment; namespace node { using v8::Context; diff --git a/src/async_wrap.cc b/src/async_wrap.cc index e11ce076819c6c..972f751b96d020 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -21,7 +21,6 @@ #include "async_wrap.h" // NOLINT(build/include_inline) #include "async_wrap-inl.h" -#include "env-inl.h" #include "node_errors.h" #include "tracing/traced_value.h" #include "util-inl.h" @@ -59,6 +58,8 @@ using v8::WeakCallbackType; using TryCatchScope = node::errors::TryCatchScope; +class Environment; + namespace node { static const char* const provider_names[] = { diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 0be02596f96945..cf78f58aa0945d 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -22,7 +22,6 @@ #define CARES_STATICLIB #include "ares.h" #include "async_wrap-inl.h" -#include "env-inl.h" #include "memory_tracker-inl.h" #include "node.h" #include "req_wrap-inl.h" @@ -53,6 +52,7 @@ # define AI_V4MAPPED 0 #endif +class Environment; namespace node { namespace cares_wrap { diff --git a/src/connect_wrap.cc b/src/connect_wrap.cc index dacdf72da7c494..bcca9b965126c0 100644 --- a/src/connect_wrap.cc +++ b/src/connect_wrap.cc @@ -1,9 +1,9 @@ #include "connect_wrap.h" -#include "env-inl.h" #include "req_wrap-inl.h" #include "util-inl.h" +class Environment; namespace node { using v8::Local; diff --git a/src/connection_wrap.cc b/src/connection_wrap.cc index 300f7d316b8309..851fc9f06e71f2 100644 --- a/src/connection_wrap.cc +++ b/src/connection_wrap.cc @@ -1,13 +1,13 @@ #include "connection_wrap.h" #include "connect_wrap.h" -#include "env-inl.h" #include "pipe_wrap.h" #include "stream_base-inl.h" #include "stream_wrap.h" #include "tcp_wrap.h" #include "util-inl.h" +class Environment; namespace node { using v8::Boolean; diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index 5033f027b1f2e0..f65acdb8932375 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -20,13 +20,12 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "async_wrap-inl.h" -#include "env-inl.h" #include "util-inl.h" #include "node.h" #include "handle_wrap.h" #include "string_bytes.h" - +class Environment; namespace node { using v8::Context; diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 0959b7ab130036..68007215a293a2 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -21,10 +21,10 @@ #include "handle_wrap.h" #include "async_wrap-inl.h" -#include "env-inl.h" #include "util-inl.h" #include "node.h" +class Environment; namespace node { using v8::Context; diff --git a/src/heap_utils.cc b/src/heap_utils.cc index 8391f1de3726c1..13211bedb8d351 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -1,5 +1,4 @@ #include "diagnosticfilename-inl.h" -#include "env-inl.h" #include "memory_tracker-inl.h" #include "stream_base-inl.h" #include "util-inl.h" @@ -24,6 +23,7 @@ using v8::ObjectTemplate; using v8::String; using v8::Value; +class Environment; namespace node { namespace heap { diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc index 609d70d22f843c..5dafe9518a6d5f 100644 --- a/src/inspector/tracing_agent.cc +++ b/src/inspector/tracing_agent.cc @@ -7,6 +7,7 @@ #include #include +class Environment; namespace node { namespace inspector { namespace protocol { diff --git a/src/js_stream.cc b/src/js_stream.cc index 1d61605d6459d4..fc2804dd10274c 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -1,13 +1,13 @@ #include "js_stream.h" #include "async_wrap.h" -#include "env-inl.h" #include "node_buffer.h" #include "node_errors.h" #include "stream_base-inl.h" #include "util-inl.h" #include "v8.h" +class Environment; namespace node { using errors::TryCatchScope; diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 3b4be5a8105f62..affb694a6fa279 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -24,7 +24,6 @@ #include "node_errors.h" #include "node_internals.h" -#include "env-inl.h" #include "string_bytes.h" #include "string_search.h" #include "util-inl.h" @@ -34,6 +33,7 @@ #include #include +class Environment; #define THROW_AND_RETURN_UNLESS_BUFFER(env, obj) \ THROW_AND_RETURN_IF_NOT_BUFFER(env, obj, "argument") \ diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 76a8cc8a193f1e..9eec266fc673d6 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -31,7 +31,6 @@ #include "async_wrap-inl.h" #include "base_object-inl.h" -#include "env-inl.h" #include "memory_tracker-inl.h" #include "string_bytes.h" #include "threadpoolwork-inl.h" @@ -59,6 +58,8 @@ #include #include +class Environment; + static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_UTF8_CONVERT | XN_FLAG_SEP_MULTILINE diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index fef91750d541e1..c7fe129fd48b1f 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -26,10 +26,10 @@ #include "node_crypto.h" #include "openssl/bio.h" -#include "env.h" #include "util.h" #include "v8.h" +class Environment; namespace node { namespace crypto { diff --git a/src/node_http_parser_impl.h b/src/node_http_parser_impl.h index a354c6fcc51eba..11ccbebe1fc280 100644 --- a/src/node_http_parser_impl.h +++ b/src/node_http_parser_impl.h @@ -29,7 +29,6 @@ #include "util.h" #include "async_wrap-inl.h" -#include "env-inl.h" #include "stream_base-inl.h" #include "v8.h" @@ -50,7 +49,7 @@ // No copying is performed when slicing the buffer, only small reference // allocations. - +class Environment; namespace node { namespace { // NOLINT(build/namespaces) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 8ccda35056c342..1e595e18e75a86 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -67,6 +67,7 @@ #include #include +class Environment; #ifdef NODE_HAVE_SMALL_ICU /* if this is defined, we have a 'secondary' entry point. compare following to utypes.h defs for U_ICUDATA_ENTRY_POINT */ diff --git a/src/node_platform.cc b/src/node_platform.cc index 406146b841e25e..4edae38662e467 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -1,12 +1,12 @@ #include "node_platform.h" #include "node_internals.h" -#include "env-inl.h" #include "debug_utils.h" #include #include #include +class Environment; namespace node { using v8::Isolate; diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index a9ddd70bcbe2d6..e2ab4ff1aa6dcd 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -1,5 +1,4 @@ #include "base_object-inl.h" -#include "env-inl.h" #include "node.h" #include "node_errors.h" #include "node_internals.h" @@ -28,6 +27,7 @@ typedef int mode_t; #include // tcgetattr, tcsetattr #endif +class Environment; namespace node { using v8::Array; diff --git a/src/node_process_object.cc b/src/node_process_object.cc index e533245703e8cc..57b8af6a0c0f74 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -1,4 +1,3 @@ -#include "env-inl.h" #include "node_internals.h" #include "node_options-inl.h" #include "node_metadata.h" @@ -8,6 +7,7 @@ #include // PATH_MAX +class Environment; namespace node { using v8::Context; using v8::DEFAULT; diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc index a277b8bd2abb92..92a1bbb2e9b285 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -1,4 +1,3 @@ -#include "env-inl.h" #include "node.h" #include "node_errors.h" #include "node_internals.h" @@ -8,6 +7,7 @@ #include +class Environment; namespace node { using v8::Array; diff --git a/src/node_url.h b/src/node_url.h index e85ca6e7129f6a..7298436a1c1ce0 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -4,10 +4,9 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "env.h" - #include +class Environment; namespace node { namespace url { diff --git a/src/node_v8_platform-inl.h b/src/node_v8_platform-inl.h index e36f0a7d88bea4..f361aad74629e8 100644 --- a/src/node_v8_platform-inl.h +++ b/src/node_v8_platform-inl.h @@ -5,7 +5,6 @@ #include -#include "env-inl.h" #include "node.h" #include "node_metadata.h" #include "node_options.h" @@ -13,6 +12,7 @@ #include "tracing/trace_event.h" #include "tracing/traced_value.h" +class Environment; namespace node { // Ensures that __metadata trace events are only emitted diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 30fef0ff1d4d57..0a01d6b3777d55 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -24,7 +24,6 @@ #include "node_buffer.h" #include "async_wrap-inl.h" -#include "env-inl.h" #include "threadpoolwork-inl.h" #include "util-inl.h" @@ -41,6 +40,7 @@ #include #include +class Environment; namespace node { using v8::Array; diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index c2be4320387549..19f08e9b1e5c72 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -23,7 +23,6 @@ #include "async_wrap.h" #include "connection_wrap.h" -#include "env-inl.h" #include "handle_wrap.h" #include "node.h" #include "node_buffer.h" @@ -32,6 +31,7 @@ #include "stream_wrap.h" #include "util-inl.h" +class Environment; namespace node { using v8::Context; diff --git a/src/process_wrap.cc b/src/process_wrap.cc index a75f271d1c77b8..a1e61dee9e8948 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "env-inl.h" #include "stream_base-inl.h" #include "stream_wrap.h" #include "util-inl.h" @@ -27,6 +26,7 @@ #include #include +class Environment; namespace node { using v8::Array; diff --git a/src/req_wrap-inl.h b/src/req_wrap-inl.h index cf89fb58a7f6fc..2682a7fce1ba1c 100644 --- a/src/req_wrap-inl.h +++ b/src/req_wrap-inl.h @@ -7,6 +7,7 @@ #include "async_wrap-inl.h" #include "uv.h" +class Environment; namespace node { ReqWrapBase::ReqWrapBase(Environment* env) { diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 90b91f35a86c8b..4413030bca669e 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -20,12 +20,12 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "async_wrap-inl.h" -#include "env-inl.h" #include "handle_wrap.h" #include "node_process.h" #include "util-inl.h" #include "v8.h" +class Environment; namespace node { using v8::Context; diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 0751bc21a7eb3d..f6a99eea65fe79 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -21,14 +21,13 @@ #include "spawn_sync.h" #include "debug_utils.h" -#include "env-inl.h" #include "node_internals.h" #include "string_bytes.h" #include "util-inl.h" #include - +class Environment; namespace node { using v8::Array; diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 65af037d152763..50325db06b43dc 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -6,9 +6,9 @@ #include "stream_base.h" #include "node.h" -#include "env-inl.h" #include "v8.h" +class Environment; namespace node { using v8::Signature; diff --git a/src/stream_base.cc b/src/stream_base.cc index 695d19c123ede3..1be6ac0842c730 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -5,7 +5,6 @@ #include "node.h" #include "node_buffer.h" #include "node_errors.h" -#include "env-inl.h" #include "js_stream.h" #include "string_bytes.h" #include "util-inl.h" @@ -13,6 +12,7 @@ #include // INT_MAX +class Environment; namespace node { using v8::Array; diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 1ec8386fbbb534..360ce629fd64d3 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -22,7 +22,6 @@ #include "stream_wrap.h" #include "stream_base-inl.h" -#include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" #include "pipe_wrap.h" @@ -34,7 +33,7 @@ #include // memcpy() #include // INT_MAX - +class Environment; namespace node { using v8::Context; diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 131a0333be22dc..1047f20268e1cc 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -22,7 +22,6 @@ #include "string_bytes.h" #include "base64.h" -#include "env-inl.h" #include "node_buffer.h" #include "node_errors.h" #include "util.h" @@ -38,6 +37,7 @@ // use external string resources. #define EXTERN_APEX 0xFBEE9 +class Environment; namespace node { using v8::HandleScope; diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 89c4e215bbe6ae..b635c7b8916fd7 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -22,7 +22,6 @@ #include "tcp_wrap.h" #include "connection_wrap.h" -#include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" #include "node_internals.h" @@ -33,7 +32,7 @@ #include - +class Environment; namespace node { using v8::Boolean; diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index 3d19c6c75844fc..c1fed9989a472d 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -4,8 +4,8 @@ #include "trace_event.h" #include "tracing/node_trace_buffer.h" #include "debug_utils.h" -#include "env-inl.h" +class Environment; namespace node { namespace tracing { diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 7dface926e4349..06330178c21ed3 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -21,13 +21,13 @@ #include "tty_wrap.h" -#include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" #include "stream_base-inl.h" #include "stream_wrap.h" #include "util-inl.h" +class Environment; namespace node { using v8::Array; diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 3c66db2155ab74..a02601a87bd260 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -20,12 +20,12 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "udp_wrap.h" -#include "env-inl.h" #include "node_buffer.h" #include "handle_wrap.h" #include "req_wrap-inl.h" #include "util-inl.h" +class Environment; namespace node { using v8::Array;