diff --git a/src/api/environment.cc b/src/api/environment.cc index e5d06f27d13110..eeeef7442d834a 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 3e59932f2f8b73..da7281a68f3bb1 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 00000000000000..58a3a933acc605 --- /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 acc63fd1d9a14c..8391f1de3726c1 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 d87eec6a6469b9..609d70d22f843c 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 diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 7ba19087d01b0d..223e3592a1fc09 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 7e76ad778a0f4a..2a1559f8f97495 100644 --- a/src/inspector_profiler.cc +++ b/src/inspector_profiler.cc @@ -2,6 +2,7 @@ #include #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 32393883d7c601..91e6a14cdc1570 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1,9 +1,9 @@ -#include #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 0c565c447fb862..8ccda35056c342 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 8e6734192cbded..21625e60232bbe 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 2f668b54630761..18607656256d51 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 2581af06fac62d..33d7c52b34f78e 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 24e1d66fb7e7f4..f5852076b4ec68 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" diff --git a/tools/snapshot/node_mksnapshot.cc b/tools/snapshot/node_mksnapshot.cc index 5cf24f32b49e01..f52cccb705f53a 100644 --- a/tools/snapshot/node_mksnapshot.cc +++ b/tools/snapshot/node_mksnapshot.cc @@ -5,7 +5,6 @@ #include #include -#include "env-inl.h" #include "libplatform/libplatform.h" #include "node_internals.h" #include "snapshot_builder.h" diff --git a/tools/snapshot/snapshot_builder.cc b/tools/snapshot/snapshot_builder.cc index 1faa5330ae118f..54a4a2e73da249 100644 --- a/tools/snapshot/snapshot_builder.cc +++ b/tools/snapshot/snapshot_builder.cc @@ -1,7 +1,6 @@ #include "snapshot_builder.h" #include #include -#include "env-inl.h" #include "node_internals.h" #include "node_main_instance.h" #include "node_v8_platform-inl.h"