src: clean up node_file.h · nodejs/node@be84cee · GitHub
Skip to content

Commit be84cee

Browse files
committed
src: clean up node_file.h
- Move inline functions into an `-inl.h` file - Move override function definitions into `.cc` files - Remove `using` statements from header files - Make data fields of classes private - Mark classes at the end of hierarchies as `final` This is also partially being done in an attempt to avoid a particular internal compiler error, see #30475 (comment) for details. PR-URL: #30530 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent bccfd12 commit be84cee

10 files changed

Lines changed: 462 additions & 327 deletions

File tree

node.gyp

Lines changed: 1 addition & 0 deletions

src/env.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "node_process.h"
1212
#include "node_v8_platform-inl.h"
1313
#include "node_worker.h"
14+
#include "req_wrap-inl.h"
1415
#include "tracing/agent.h"
1516
#include "tracing/traced_value.h"
1617
#include "util-inl.h"
@@ -35,6 +36,7 @@ using v8::HandleScope;
3536
using v8::Integer;
3637
using v8::Isolate;
3738
using v8::Local;
39+
using v8::MaybeLocal;
3840
using v8::NewStringType;
3941
using v8::Number;
4042
using v8::Object;

src/node_dir.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include "node_dir.h"
2+
#include "node_file-inl.h"
23
#include "node_process.h"
4+
#include "memory_tracker-inl.h"
35
#include "util.h"
46

57
#include "tracing/trace_event.h"
68

7-
#include "req_wrap-inl.h"
89
#include "string_bytes.h"
910

1011
#include <fcntl.h>
@@ -85,6 +86,10 @@ DirHandle::~DirHandle() {
8586
CHECK(closed_); // We have to be closed at the point
8687
}
8788

89+
void DirHandle::MemoryInfo(MemoryTracker* tracker) const {
90+
tracker->TrackFieldWithSize("dir", sizeof(*dir_));
91+
}
92+
8893
// Close the directory handle if it hasn't already been closed. A process
8994
// warning will be emitted using a SetImmediate to avoid calling back to
9095
// JS during GC. If closing the fd fails at this point, a fatal exception

src/node_dir.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

66
#include "node_file.h"
7-
#include "node.h"
8-
#include "req_wrap-inl.h"
97

108
namespace node {
119

@@ -20,16 +18,13 @@ class DirHandle : public AsyncWrap {
2018
~DirHandle() override;
2119

2220
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
23-
static void Open(const v8::FunctionCallbackInfo<Value>& args);
24-
static void Read(const v8::FunctionCallbackInfo<Value>& args);
25-
static void Close(const v8::FunctionCallbackInfo<Value>& args);
21+
static void Open(const v8::FunctionCallbackInfo<v8::Value>& args);
22+
static void Read(const v8::FunctionCallbackInfo<v8::Value>& args);
23+
static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
2624

2725
inline uv_dir_t* dir() { return dir_; }
2826

29-
void MemoryInfo(MemoryTracker* tracker) const override {
30-
tracker->TrackFieldWithSize("dir", sizeof(*dir_));
31-
}
32-
27+
void MemoryInfo(MemoryTracker* tracker) const override;
3328
SET_MEMORY_INFO_NAME(DirHandle)
3429
SET_SELF_SIZE(DirHandle)
3530

src/node_file-inl.h

Lines changed: 283 additions & 0 deletions

0 commit comments

Comments
 (0)