@@ -70,8 +70,8 @@ AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( |
70 | 70 | count_(that.count_), |
71 | 71 | byte_offset_(that.byte_offset_), |
72 | 72 | buffer_(that.buffer_) { |
73 | | - DCHECK(is_valid()); |
74 | 73 | js_array_ = v8::Global<V8T>(that.isolate_, that.GetJSArray()); |
| 74 | + DCHECK(is_valid()); |
75 | 75 | } |
76 | 76 |
|
77 | 77 | template <typename NativeT, typename V8T> |
@@ -126,19 +126,10 @@ void AliasedBufferBase<NativeT, V8T>::Release() { |
126 | 126 | js_array_.Reset(); |
127 | 127 | } |
128 | 128 |
|
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 | | - |
138 | 129 | template <typename NativeT, typename V8T> |
139 | 130 | inline void AliasedBufferBase<NativeT, V8T>::MakeWeak() { |
140 | 131 | DCHECK(is_valid()); |
141 | | - js_array_.SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter); |
| 132 | + js_array_.SetWeak(); |
142 | 133 | } |
143 | 134 |
|
144 | 135 | template <typename NativeT, typename V8T> |
@@ -223,7 +214,7 @@ void AliasedBufferBase<NativeT, V8T>::reserve(size_t new_capacity) { |
223 | 214 |
|
224 | 215 | template <typename NativeT, typename V8T> |
225 | 216 | inline bool AliasedBufferBase<NativeT, V8T>::is_valid() const { |
226 | | - return index_ == nullptr && !cleared_; |
| 217 | + return index_ == nullptr && !js_array_.IsEmpty(); |
227 | 218 | } |
228 | 219 |
|
229 | 220 | template <typename NativeT, typename V8T> |
|