Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove memory_tracker-inl.h from header files #27755

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/environment.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "env.h"
#include "env-inl.h"
#include "node.h"
#include "node_context_data.h"
#include "node_errors.h"
Expand Down
1 change: 1 addition & 0 deletions src/api/utils.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "env-inl.h"
#include "node.h"
#include "node_internals.h"
#include "util-inl.h"
Expand Down
2 changes: 1 addition & 1 deletion src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "memory_tracker-inl.h"
#include "memory_tracker.h"
#include "v8.h"
#include <type_traits> // std::remove_reference

Expand Down
1 change: 1 addition & 0 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#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"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/debug_utils.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "debug_utils.h"
#include "env-inl.h"
#include "util-inl.h"

#ifdef __POSIX__
Expand Down
2 changes: 1 addition & 1 deletion src/debug_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "async_wrap.h"
#include "env-inl.h"
#include "env.h"

#include <sstream>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions src/env.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "env.h"

#include "async_wrap.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
#include "node_context_data.h"
#include "node_errors.h"
Expand Down
1 change: 1 addition & 0 deletions src/heap_utils.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "stream_base-inl.h"
#include "util-inl.h"

Expand Down
1 change: 1 addition & 0 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "inspector_agent.h"

#include "env-inl.h"
#include "inspector/main_thread_interface.h"
#include "inspector/node_string.h"
#include "inspector/runtime_agent.h"
Expand Down
1 change: 1 addition & 0 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "base_object-inl.h"
#include "inspector_agent.h"
#include "inspector_io.h"
#include "memory_tracker-inl.h"
#include "util-inl.h"
#include "v8.h"
#include "v8-inspector.h"
Expand Down
1 change: 1 addition & 0 deletions src/inspector_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <sstream>
#include "base_object-inl.h"
#include "debug_utils.h"
#include "memory_tracker-inl.h"
#include "node_file.h"
#include "node_internals.h"
#include "v8-inspector.h"
Expand Down
1 change: 1 addition & 0 deletions src/js_native_api_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <cmath>
#include <algorithm>
#define NAPI_EXPERIMENTAL
#include "env-inl.h"
#include "js_native_api_v8.h"
#include "js_native_api.h"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "module_wrap.h"

#include "env.h"
#include "memory_tracker-inl.h"
#include "node_errors.h"
#include "node_url.h"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "debug_utils.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node_binding.h"
#include "node_internals.h"
#include "node_main_instance.h"
Expand Down
3 changes: 2 additions & 1 deletion src/node_api.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <node_buffer.h>
#include "env.h"
#include "env-inl.h"
#define NAPI_EXPERIMENTAL
#include "js_native_api_v8.h"
#include "node_api.h"
#include "node_binding.h"
#include "node_errors.h"
#include "node_internals.h"
#include "threadpoolwork-inl.h"
#include "util-inl.h"

#include <memory>
Expand Down
1 change: 1 addition & 0 deletions src/node_config.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "env-inl.h"
#include "memory_tracker.h"
#include "node.h"
#include "node_i18n.h"
#include "node_native_module_env.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// 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 "node_constants.h"
#include "node_internals.h"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "node_contextify.h"

#include "memory_tracker-inl.h"
#include "node_internals.h"
#include "node_watchdog.h"
#include "base_object-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_credentials.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "env-inl.h"
#include "node_internals.h"
#include "util-inl.h"

Expand Down
2 changes: 2 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#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"
#include "util-inl.h"
#include "v8.h"

Expand Down
1 change: 1 addition & 0 deletions src/node_crypto_bio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "base_object-inl.h"
#include "memory_tracker-inl.h"
#include "node_crypto_bio.h"
#include "openssl/bio.h"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "node_file.h"
#include "aliased_buffer.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
#include "node_process.h"
#include "node_stat_watcher.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "aliased_buffer.h"
#include "debug_utils.h"
#include "memory_tracker-inl.h"
#include "node.h"
#include "node_buffer.h"
#include "node_http2.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_http_parser_llhttp.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define NODE_EXPERIMENTAL_HTTP 1

#include "node_http_parser_impl.h"
#include "memory_tracker-inl.h"
#include "node_metadata.h"
#include "util-inl.h"

Expand Down
1 change: 1 addition & 0 deletions src/node_http_parser_traditional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#undef NODE_EXPERIMENTAL_HTTP
#endif

#include "memory_tracker-inl.h"
#include "node_http_parser_impl.h"
#include "node_metadata.h"
#include "util-inl.h"
Expand Down
23 changes: 1 addition & 22 deletions src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "env-inl.h"
#include "env.h"
#include "node.h"
#include "node_binding.h"
#include "node_mutex.h"
Expand Down Expand Up @@ -252,27 +252,6 @@ class ThreadPoolWork {
uv_work_t work_req_;
};

void ThreadPoolWork::ScheduleWork() {
env_->IncreaseWaitingRequestCounter();
int status = uv_queue_work(
env_->event_loop(),
&work_req_,
[](uv_work_t* req) {
ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
self->DoThreadPoolWork();
},
[](uv_work_t* req, int status) {
ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
self->env_->DecreaseWaitingRequestCounter();
self->AfterThreadPoolWork(status);
});
CHECK_EQ(status, 0);
}

int ThreadPoolWork::CancelWork() {
return uv_cancel(reinterpret_cast<uv_req_t*>(&work_req_));
}

#define TRACING_CATEGORY_NODE "node"
#define TRACING_CATEGORY_NODE1(one) \
TRACING_CATEGORY_NODE "," \
Expand Down
1 change: 1 addition & 0 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "async_wrap-inl.h"
#include "debug_utils.h"
#include "memory_tracker-inl.h"
#include "node_contextify.h"
#include "node_buffer.h"
#include "node_errors.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_perf.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "aliased_buffer.h"
#include "memory_tracker-inl.h"
#include "node_internals.h"
#include "node_perf.h"
#include "node_buffer.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_report.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "env-inl.h"
#include "node_report.h"
#include "debug_utils.h"
#include "node_internals.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_report_utils.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "env-inl.h"
#include "node_internals.h"
#include "node_report.h"
#include "util-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_stat_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "memory_tracker-inl.h"
#include "node_stat_watcher.h"
#include "async_wrap-inl.h"
#include "env.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_trace_events.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "base_object-inl.h"
#include "env.h"
#include "memory_tracker-inl.h"
#include "node.h"
#include "node_internals.h"
#include "node_v8_platform-inl.h"
Expand Down
2 changes: 1 addition & 1 deletion src/node_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node.h"
#include "env-inl.h"
#include "env.h"

#include <string>

Expand Down
4 changes: 3 additions & 1 deletion src/node_watchdog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "node_watchdog.h"
#include <algorithm>

#include "debug_utils.h"
#include "env-inl.h"
#include "node_errors.h"
#include "node_internals.h"
#include "node_watchdog.h"
#include "util-inl.h"

namespace node {
Expand Down
1 change: 1 addition & 0 deletions src/node_worker.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "node_worker.h"
#include "debug_utils.h"
#include "memory_tracker-inl.h"
#include "node_errors.h"
#include "node_buffer.h"
#include "node_options-inl.h"
Expand Down
2 changes: 2 additions & 0 deletions src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "memory_tracker-inl.h"
#include "node.h"
#include "node_buffer.h"

#include "async_wrap-inl.h"
#include "env-inl.h"
#include "threadpoolwork-inl.h"
#include "util-inl.h"

#include "v8.h"
Expand Down
57 changes: 57 additions & 0 deletions src/threadpoolwork-inl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef SRC_THREADPOOLWORK_INL_H_
#define SRC_THREADPOOLWORK_INL_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "util-inl.h"
#include "node_internals.h"

namespace node {

void ThreadPoolWork::ScheduleWork() {
env_->IncreaseWaitingRequestCounter();
int status = uv_queue_work(
env_->event_loop(),
&work_req_,
[](uv_work_t* req) {
ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
self->DoThreadPoolWork();
},
[](uv_work_t* req, int status) {
ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
self->env_->DecreaseWaitingRequestCounter();
self->AfterThreadPoolWork(status);
});
CHECK_EQ(status, 0);
}

int ThreadPoolWork::CancelWork() {
return uv_cancel(reinterpret_cast<uv_req_t*>(&work_req_));
}

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_THREADPOOLWORK_INL_H_
1 change: 1 addition & 0 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "tls_wrap.h"
#include "async_wrap-inl.h"
#include "debug_utils.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h" // Buffer
#include "node_crypto.h" // SecureContext
#include "node_crypto_bio.h" // NodeBIO
Expand Down
1 change: 1 addition & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "util.h" // NOLINT(build/include_inline)
#include "util-inl.h"

#include "env-inl.h"
#include "node_buffer.h"
#include "node_errors.h"
#include "node_internals.h"
Expand Down
2 changes: 1 addition & 1 deletion test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "node.h"
#include "node_platform.h"
#include "node_internals.h"
#include "env.h"
#include "env-inl.h"
#include "util-inl.h"
#include "v8.h"
#include "libplatform/libplatform.h"
Expand Down
Loading