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: remove aliased buffer weak callback · nodejs/node@120ac74

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • aliased_buffer-inl.h
    • aliased_buffer.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/aliased_buffer-inl.h‎

Copy file name to clipboardExpand all lines: src/aliased_buffer-inl.h
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ AliasedBufferBase<NativeT, V8T>::AliasedBufferBase(
7070
count_(that.count_),
7171
byte_offset_(that.byte_offset_),
7272
buffer_(that.buffer_) {
73-
DCHECK(is_valid());
7473
js_array_ = v8::Global<V8T>(that.isolate_, that.GetJSArray());
74+
DCHECK(is_valid());
7575
}
7676

7777
template <typename NativeT, typename V8T>
@@ -126,19 +126,10 @@ void AliasedBufferBase<NativeT, V8T>::Release() {
126126
js_array_.Reset();
127127
}
128128

129-
template <typename NativeT, typename V8T>
130-
inline void AliasedBufferBase<NativeT, V8T>::WeakCallback(
131-
const v8::WeakCallbackInfo<AliasedBufferBase<NativeT, V8T>>& data) {
132-
AliasedBufferBase<NativeT, V8T>* buffer = data.GetParameter();
133-
DCHECK(buffer->is_valid());
134-
buffer->cleared_ = true;
135-
buffer->js_array_.Reset();
136-
}
137-
138129
template <typename NativeT, typename V8T>
139130
inline void AliasedBufferBase<NativeT, V8T>::MakeWeak() {
140131
DCHECK(is_valid());
141-
js_array_.SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter);
132+
js_array_.SetWeak();
142133
}
143134

144135
template <typename NativeT, typename V8T>
@@ -223,7 +214,7 @@ void AliasedBufferBase<NativeT, V8T>::reserve(size_t new_capacity) {
223214

224215
template <typename NativeT, typename V8T>
225216
inline bool AliasedBufferBase<NativeT, V8T>::is_valid() const {
226-
return index_ == nullptr && !cleared_;
217+
return index_ == nullptr && !js_array_.IsEmpty();
227218
}
228219

229220
template <typename NativeT, typename V8T>
Collapse file

‎src/aliased_buffer.h‎

Copy file name to clipboardExpand all lines: src/aliased_buffer.h
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,11 @@ class AliasedBufferBase : public MemoryRetainer {
173173

174174
private:
175175
inline bool is_valid() const;
176-
static inline void WeakCallback(
177-
const v8::WeakCallbackInfo<AliasedBufferBase<NativeT, V8T>>& data);
178176
v8::Isolate* isolate_ = nullptr;
179177
size_t count_ = 0;
180178
size_t byte_offset_ = 0;
181179
NativeT* buffer_ = nullptr;
182180
v8::Global<V8T> js_array_;
183-
bool cleared_ = false;
184181

185182
// Deserialize data
186183
const AliasedBufferIndex* index_ = nullptr;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.