GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: prevent persistent handle resource leaks · inre/node@992703f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • node.gyp
  • src
    • async_wrap.cc
    • base_object-inl.h
    • base_object.h
    • env-inl.h
    • env.h
    • inspector_agent.cc
    • inspector_agent.h
    • inspector_js_api.cc
    • module_wrap.h
    • node_api.cc
    • node_buffer.cc
    • node_contextify.cc
    • node_contextify.h
    • node_crypto.cc
    • node_crypto.h
    • node_file.h
    • node_internals.h
    • node_persistent.h
    • node_zlib.cc
    • stream_base-inl.h
    • stream_base.h
    • stream_wrap.cc
    • util-inl.h
    • util.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,10 @@
371371
'src/node_internals.h',
372372
'src/node_javascript.h',
373373
'src/node_mutex.h',
374-
'src/node_platform.h',
375374
'src/node_perf.h',
376375
'src/node_perf_common.h',
376+
'src/node_persistent.h',
377+
'src/node_platform.h',
377378
'src/node_root_certs.h',
378379
'src/node_version.h',
379380
'src/node_watchdog.h',
Collapse file

‎src/async_wrap.cc‎

Copy file name to clipboardExpand all lines: src/async_wrap.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ static void DisablePromiseHook(const FunctionCallbackInfo<Value>& args) {
409409
class DestroyParam {
410410
public:
411411
double asyncId;
412-
v8::Persistent<Object> target;
413-
v8::Persistent<Object> propBag;
412+
Persistent<Object> target;
413+
Persistent<Object> propBag;
414414
};
415415

416416

Collapse file

‎src/base_object-inl.h‎

Copy file name to clipboardExpand all lines: src/base_object-inl.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ inline BaseObject::~BaseObject() {
4747
}
4848

4949

50-
inline v8::Persistent<v8::Object>& BaseObject::persistent() {
50+
inline Persistent<v8::Object>& BaseObject::persistent() {
5151
return persistent_handle_;
5252
}
5353

Collapse file

‎src/base_object.h‎

Copy file name to clipboardExpand all lines: src/base_object.h
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2626

27+
#include "node_persistent.h"
2728
#include "v8.h"
2829

2930
namespace node {
@@ -39,12 +40,7 @@ class BaseObject {
3940
// persistent.IsEmpty() is true.
4041
inline v8::Local<v8::Object> object();
4142

42-
// The parent class is responsible for calling .Reset() on destruction
43-
// when the persistent handle is strong because there is no way for
44-
// BaseObject to know when the handle goes out of scope.
45-
// Weak handles have been reset by the time the destructor runs but
46-
// calling .Reset() again is harmless.
47-
inline v8::Persistent<v8::Object>& persistent();
43+
inline Persistent<v8::Object>& persistent();
4844

4945
inline Environment* env() const;
5046

@@ -71,7 +67,7 @@ class BaseObject {
7167
// position of members in memory are predictable. For more information please
7268
// refer to `doc/guides/node-postmortem-support.md`
7369
friend int GenDebugSymbols();
74-
v8::Persistent<v8::Object> persistent_handle_;
70+
Persistent<v8::Object> persistent_handle_;
7571
Environment* env_;
7672
};
7773

Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ void Environment::CreateImmediate(native_immediate_callback cb,
550550
native_immediate_callbacks_.push_back({
551551
cb,
552552
data,
553-
std::unique_ptr<v8::Persistent<v8::Object>>(obj.IsEmpty() ?
554-
nullptr : new v8::Persistent<v8::Object>(isolate_, obj)),
553+
std::unique_ptr<Persistent<v8::Object>>(obj.IsEmpty() ?
554+
nullptr : new Persistent<v8::Object>(isolate_, obj)),
555555
ref
556556
});
557557
immediate_info()->count_inc(1);
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ class Environment {
847847
struct NativeImmediateCallback {
848848
native_immediate_callback cb_;
849849
void* data_;
850-
std::unique_ptr<v8::Persistent<v8::Object>> keep_alive_;
850+
std::unique_ptr<Persistent<v8::Object>> keep_alive_;
851851
bool refed_;
852852
};
853853
std::vector<NativeImmediateCallback> native_immediate_callbacks_;
@@ -858,8 +858,7 @@ class Environment {
858858
v8::Local<v8::Promise> promise,
859859
v8::Local<v8::Value> parent);
860860

861-
#define V(PropertyName, TypeName) \
862-
v8::Persistent<TypeName> PropertyName ## _;
861+
#define V(PropertyName, TypeName) Persistent<TypeName> PropertyName ## _;
863862
ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
864863
#undef V
865864

Collapse file

‎src/inspector_agent.cc‎

Copy file name to clipboardExpand all lines: src/inspector_agent.cc
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ using v8::HandleScope;
3030
using v8::Isolate;
3131
using v8::Local;
3232
using v8::Object;
33-
using v8::Persistent;
3433
using v8::String;
3534
using v8::Value;
3635

Collapse file

‎src/inspector_agent.h‎

Copy file name to clipboardExpand all lines: src/inspector_agent.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Agent {
9797

9898
private:
9999
void ToggleAsyncHook(v8::Isolate* isolate,
100-
const v8::Persistent<v8::Function>& fn);
100+
const Persistent<v8::Function>& fn);
101101

102102
node::Environment* parent_env_;
103103
std::unique_ptr<NodeInspectorClient> client_;
@@ -109,8 +109,8 @@ class Agent {
109109

110110
bool pending_enable_async_hook_;
111111
bool pending_disable_async_hook_;
112-
v8::Persistent<v8::Function> enable_async_hook_function_;
113-
v8::Persistent<v8::Function> disable_async_hook_function_;
112+
Persistent<v8::Function> enable_async_hook_function_;
113+
Persistent<v8::Function> disable_async_hook_function_;
114114
};
115115

116116
} // namespace inspector
Collapse file

‎src/inspector_js_api.cc‎

Copy file name to clipboardExpand all lines: src/inspector_js_api.cc
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ using v8::Local;
1919
using v8::MaybeLocal;
2020
using v8::NewStringType;
2121
using v8::Object;
22-
using v8::Persistent;
2322
using v8::String;
2423
using v8::Value;
2524

Collapse file

‎src/module_wrap.h‎

Copy file name to clipboardExpand all lines: src/module_wrap.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class ModuleWrap : public BaseObject {
6262
static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
6363

6464

65-
v8::Persistent<v8::Module> module_;
66-
v8::Persistent<v8::String> url_;
65+
Persistent<v8::Module> module_;
66+
Persistent<v8::String> url_;
6767
bool linked_ = false;
68-
std::unordered_map<std::string, v8::Persistent<v8::Promise>> resolve_cache_;
69-
v8::Persistent<v8::Context> context_;
68+
std::unordered_map<std::string, Persistent<v8::Promise>> resolve_cache_;
69+
Persistent<v8::Context> context_;
7070
};
7171

7272
} // namespace loader

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.