1010
1111namespace node {
1212
13- typedef size_t AliasedBufferInfo ;
13+ typedef size_t AliasedBufferIndex ;
1414
1515/* *
1616 * Do not use this class directly when creating instances of it - use the
@@ -37,10 +37,10 @@ class AliasedBufferBase {
3737 public:
3838 AliasedBufferBase (v8::Isolate* isolate,
3939 const size_t count,
40- const AliasedBufferInfo* info = nullptr )
41- : isolate_(isolate), count_(count), byte_offset_(0 ), info_(info ) {
40+ const AliasedBufferIndex* index = nullptr )
41+ : isolate_(isolate), count_(count), byte_offset_(0 ), index_(index ) {
4242 CHECK_GT (count, 0 );
43- if (info != nullptr ) {
43+ if (index != nullptr ) {
4444 // Will be deserialized later.
4545 return ;
4646 }
@@ -72,12 +72,12 @@ class AliasedBufferBase {
7272 const size_t byte_offset,
7373 const size_t count,
7474 const AliasedBufferBase<uint8_t , v8::Uint8Array>& backing_buffer,
75- const AliasedBufferInfo* info = nullptr )
75+ const AliasedBufferIndex* index = nullptr )
7676 : isolate_(isolate),
7777 count_ (count),
7878 byte_offset_(byte_offset),
79- info_(info ) {
80- if (info != nullptr ) {
79+ index_(index ) {
80+ if (index != nullptr ) {
8181 // Will be deserialized later.
8282 return ;
8383 }
@@ -102,20 +102,20 @@ class AliasedBufferBase {
102102 count_(that.count_),
103103 byte_offset_(that.byte_offset_),
104104 buffer_(that.buffer_) {
105- DCHECK_NULL (info_ );
105+ DCHECK_NULL (index_ );
106106 js_array_ = v8::Global<V8T>(that.isolate_ , that.GetJSArray ());
107107 }
108108
109- AliasedBufferInfo Serialize (v8::Local<v8::Context> context,
109+ AliasedBufferIndex Serialize (v8::Local<v8::Context> context,
110110 v8::SnapshotCreator* creator) {
111- DCHECK_NULL (info_ );
111+ DCHECK_NULL (index_ );
112112 return creator->AddData (context, GetJSArray ());
113113 }
114114
115115 inline void Deserialize (v8::Local<v8::Context> context) {
116- DCHECK_NOT_NULL (info_ );
116+ DCHECK_NOT_NULL (index_ );
117117 v8::Local<V8T> arr =
118- context->GetDataFromSnapshotOnce <V8T>(*info_ ).ToLocalChecked ();
118+ context->GetDataFromSnapshotOnce <V8T>(*index_ ).ToLocalChecked ();
119119 // These may not hold true for AliasedBuffers that have grown, so should
120120 // be removed when we expand the snapshot support.
121121 DCHECK_EQ (count_, arr->Length ());
@@ -124,11 +124,11 @@ class AliasedBufferBase {
124124 static_cast <uint8_t *>(arr->Buffer ()->GetBackingStore ()->Data ());
125125 buffer_ = reinterpret_cast <NativeT*>(raw + byte_offset_);
126126 js_array_.Reset (isolate_, arr);
127- info_ = nullptr ;
127+ index_ = nullptr ;
128128 }
129129
130130 AliasedBufferBase& operator =(AliasedBufferBase&& that) noexcept {
131- DCHECK_NULL (info_ );
131+ DCHECK_NULL (index_ );
132132 this ->~AliasedBufferBase ();
133133 isolate_ = that.isolate_ ;
134134 count_ = that.count_ ;
@@ -194,7 +194,7 @@ class AliasedBufferBase {
194194 * Get the underlying v8 TypedArray overlayed on top of the native buffer
195195 */
196196 v8::Local<V8T> GetJSArray () const {
197- DCHECK_NULL (info_ );
197+ DCHECK_NULL (index_ );
198198 return js_array_.Get (isolate_);
199199 }
200200
@@ -211,7 +211,7 @@ class AliasedBufferBase {
211211 * through the GetValue/SetValue/operator[] methods
212212 */
213213 inline const NativeT* GetNativeBuffer () const {
214- DCHECK_NULL (info_ );
214+ DCHECK_NULL (index_ );
215215 return buffer_;
216216 }
217217
@@ -227,15 +227,15 @@ class AliasedBufferBase {
227227 */
228228 inline void SetValue (const size_t index, NativeT value) {
229229 DCHECK_LT (index, count_);
230- DCHECK_NULL (info_ );
230+ DCHECK_NULL (index_ );
231231 buffer_[index] = value;
232232 }
233233
234234 /* *
235235 * Get value at position index
236236 */
237237 inline const NativeT GetValue (const size_t index) const {
238- DCHECK_NULL (info_ );
238+ DCHECK_NULL (index_ );
239239 DCHECK_LT (index, count_);
240240 return buffer_[index];
241241 }
@@ -244,7 +244,7 @@ class AliasedBufferBase {
244244 * Effectively, a synonym for GetValue/SetValue
245245 */
246246 Reference operator [](size_t index) {
247- DCHECK_NULL (info_ );
247+ DCHECK_NULL (index_ );
248248 return Reference (this , index);
249249 }
250250
@@ -260,7 +260,7 @@ class AliasedBufferBase {
260260 // Should only be used on an owning array, not one created as a sub array of
261261 // an owning `AliasedBufferBase`.
262262 void reserve (size_t new_capacity) {
263- DCHECK_NULL (info_ );
263+ DCHECK_NULL (index_ );
264264 DCHECK_GE (new_capacity, count_);
265265 DCHECK_EQ (byte_offset_, 0 );
266266 const v8::HandleScope handle_scope (isolate_);
@@ -296,7 +296,7 @@ class AliasedBufferBase {
296296 v8::Global<V8T> js_array_;
297297
298298 // Deserialize data
299- const AliasedBufferInfo* info_ = nullptr ;
299+ const AliasedBufferIndex* index_ = nullptr ;
300300};
301301
302302typedef AliasedBufferBase<int32_t , v8::Int32Array> AliasedInt32Array;
0 commit comments