diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-05-22 12:12:36 -0700 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-05-28 07:33:34 +0200 |
commit | 44846aebd24560afc4cbadca3c2e0db285d07ab0 (patch) | |
tree | 7c16aee1a709131b28424dbf58c50667d4613bdb /src | |
parent | 9d9b32eff57457ce62bfd1817aae304cba1424e0 (diff) | |
download | node-new-44846aebd24560afc4cbadca3c2e0db285d07ab0.tar.gz |
src: move DiagnosticFilename inlines into a -inl.h
DiagnosticFilename's constructor default values use inlines from
env-inl.h, causing the many users of node_internals.h to include
env-inl.h, even if they never use DiagnosticFilename.
PR-URL: https://github.com/nodejs/node/pull/27839
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/api/environment.cc | 1 | ||||
-rw-r--r-- | src/api/utils.cc | 1 | ||||
-rw-r--r-- | src/diagnosticfilename-inl.h | 33 | ||||
-rw-r--r-- | src/heap_utils.cc | 1 | ||||
-rw-r--r-- | src/inspector/tracing_agent.cc | 3 | ||||
-rw-r--r-- | src/inspector_io.cc | 1 | ||||
-rw-r--r-- | src/inspector_profiler.cc | 1 | ||||
-rw-r--r-- | src/node_api.cc | 2 | ||||
-rw-r--r-- | src/node_i18n.cc | 1 | ||||
-rw-r--r-- | src/node_internals.h | 16 | ||||
-rw-r--r-- | src/node_report.cc | 1 | ||||
-rw-r--r-- | src/node_report_utils.cc | 1 | ||||
-rw-r--r-- | src/node_trace_events.cc | 2 |
13 files changed, 45 insertions, 19 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc index e5d06f27d1..eeeef7442d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -1,4 +1,3 @@ -#include "env-inl.h" #include "node.h" #include "node_context_data.h" #include "node_errors.h" diff --git a/src/api/utils.cc b/src/api/utils.cc index 3e59932f2f..da7281a68f 100644 --- a/src/api/utils.cc +++ b/src/api/utils.cc @@ -1,4 +1,3 @@ -#include "env-inl.h" #include "node.h" #include "node_internals.h" #include "util-inl.h" diff --git a/src/diagnosticfilename-inl.h b/src/diagnosticfilename-inl.h new file mode 100644 index 0000000000..58a3a933ac --- /dev/null +++ b/src/diagnosticfilename-inl.h @@ -0,0 +1,33 @@ +#ifndef SRC_DIAGNOSTICFILENAME_INL_H_ +#define SRC_DIAGNOSTICFILENAME_INL_H_ + +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#include "node_internals.h" +#include "env-inl.h" + +namespace node { + +inline DiagnosticFilename::DiagnosticFilename( + Environment* env, + const char* prefix, + const char* ext) : + filename_(MakeFilename(env->thread_id(), prefix, ext)) { +} + +inline DiagnosticFilename::DiagnosticFilename( + uint64_t thread_id, + const char* prefix, + const char* ext) : + filename_(MakeFilename(thread_id, prefix, ext)) { +} + +inline const char* DiagnosticFilename::operator*() const { + return filename_.c_str(); +} + +} // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#endif // SRC_DIAGNOSTICFILENAME_INL_H_ diff --git a/src/heap_utils.cc b/src/heap_utils.cc index acc63fd1d9..8391f1de37 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -1,3 +1,4 @@ +#include "diagnosticfilename-inl.h" #include "env-inl.h" #include "memory_tracker-inl.h" #include "stream_base-inl.h" diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc index d87eec6a64..609d70d22f 100644 --- a/src/inspector/tracing_agent.cc +++ b/src/inspector/tracing_agent.cc @@ -2,9 +2,6 @@ #include "main_thread_interface.h" #include "node_internals.h" #include "node_v8_platform-inl.h" - -#include "env-inl.h" -#include "util-inl.h" #include "v8.h" #include <set> diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 7ba19087d0..223e3592a1 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -4,7 +4,6 @@ #include "inspector/main_thread_interface.h" #include "inspector/node_string.h" #include "base_object-inl.h" -#include "env-inl.h" #include "debug_utils.h" #include "node.h" #include "node_crypto.h" diff --git a/src/inspector_profiler.cc b/src/inspector_profiler.cc index 7e76ad778a..2a1559f8f9 100644 --- a/src/inspector_profiler.cc +++ b/src/inspector_profiler.cc @@ -2,6 +2,7 @@ #include <sstream> #include "base_object-inl.h" #include "debug_utils.h" +#include "diagnosticfilename-inl.h" #include "memory_tracker-inl.h" #include "node_file.h" #include "node_internals.h" diff --git a/src/node_api.cc b/src/node_api.cc index 32393883d7..91e6a14cdc 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1,9 +1,9 @@ -#include <node_buffer.h> #include "env-inl.h" #define NAPI_EXPERIMENTAL #include "js_native_api_v8.h" #include "node_api.h" #include "node_binding.h" +#include "node_buffer.h" #include "node_errors.h" #include "node_internals.h" #include "threadpoolwork-inl.h" diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 0c565c447f..8ccda35056 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -45,7 +45,6 @@ #if defined(NODE_HAVE_I18N_SUPPORT) #include "base_object-inl.h" -#include "env-inl.h" #include "node.h" #include "node_buffer.h" #include "node_errors.h" diff --git a/src/node_internals.h b/src/node_internals.h index 8e6734192c..21625e6023 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -324,17 +324,15 @@ class DiagnosticFilename { public: static void LocalTime(TIME_TYPE* tm_struct); - DiagnosticFilename(Environment* env, - const char* prefix, - const char* ext) : - filename_(MakeFilename(env->thread_id(), prefix, ext)) {} + inline DiagnosticFilename(Environment* env, + const char* prefix, + const char* ext); - DiagnosticFilename(uint64_t thread_id, - const char* prefix, - const char* ext) : - filename_(MakeFilename(thread_id, prefix, ext)) {} + inline DiagnosticFilename(uint64_t thread_id, + const char* prefix, + const char* ext); - const char* operator*() const { return filename_.c_str(); } + inline const char* operator*() const; private: static std::string MakeFilename( diff --git a/src/node_report.cc b/src/node_report.cc index 2f668b5463..1860765625 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -1,6 +1,7 @@ #include "env-inl.h" #include "node_report.h" #include "debug_utils.h" +#include "diagnosticfilename-inl.h" #include "node_internals.h" #include "node_metadata.h" #include "util.h" diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index 2581af06fa..33d7c52b34 100644 --- a/src/node_report_utils.cc +++ b/src/node_report_utils.cc @@ -1,4 +1,3 @@ -#include "env-inl.h" #include "node_internals.h" #include "node_report.h" #include "util-inl.h" diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 24e1d66fb7..f5852076b4 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -1,5 +1,5 @@ #include "base_object-inl.h" -#include "env.h" +#include "env-inl.h" #include "memory_tracker-inl.h" #include "node.h" #include "node_internals.h" |