@@ -22,19 +22,19 @@ typedef size_t AliasedBufferIndex;
2222 *
2323 * While this technique is computationally efficient, it is effectively a
2424 * write to JS program state w/out going through the standard
25- * (monitored) API. Thus any VM capabilities to detect the modification are
25+ * (monitored) API. Thus, any VM capabilities to detect the modification are
2626 * circumvented.
2727 *
2828 * The encapsulation herein provides a placeholder where such writes can be
2929 * observed. Any notification APIs will be left as a future exercise.
3030 */
3131template <class NativeT , class V8T >
32- class AliasedBufferBase : public MemoryRetainer {
32+ class AliasedBufferBase final : public MemoryRetainer {
3333 public:
34- static_assert (std::is_scalar <NativeT>::value );
34+ static_assert (std::is_scalar_v <NativeT>);
3535
3636 AliasedBufferBase (v8::Isolate* isolate,
37- const size_t count,
37+ size_t count,
3838 const AliasedBufferIndex* index = nullptr );
3939
4040 /* *
@@ -43,13 +43,13 @@ class AliasedBufferBase : public MemoryRetainer {
4343 * a native buffer, but will each read/write to different sections of the
4444 * native buffer.
4545 *
46- * Note that byte_offset must by aligned by sizeof(NativeT).
46+ * Note that byte_offset must be aligned by sizeof(NativeT).
4747 */
4848 // TODO(refack): refactor into a non-owning `AliasedBufferBaseView`
4949 AliasedBufferBase (
5050 v8::Isolate* isolate,
51- const size_t byte_offset,
52- const size_t count,
51+ size_t byte_offset,
52+ size_t count,
5353 const AliasedBufferBase<uint8_t , v8::Uint8Array>& backing_buffer,
5454 const AliasedBufferIndex* index = nullptr );
5555
@@ -58,7 +58,7 @@ class AliasedBufferBase : public MemoryRetainer {
5858 AliasedBufferIndex Serialize (v8::Local<v8::Context> context,
5959 v8::SnapshotCreator* creator);
6060
61- inline void Deserialize (v8::Local<v8::Context> context);
61+ void Deserialize (v8::Local<v8::Context> context);
6262
6363 AliasedBufferBase& operator =(AliasedBufferBase&& that) noexcept ;
6464
@@ -68,45 +68,45 @@ class AliasedBufferBase : public MemoryRetainer {
6868 */
6969 class Reference {
7070 public:
71- Reference (AliasedBufferBase<NativeT, V8T> * aliased_buffer, size_t index)
71+ Reference (AliasedBufferBase* aliased_buffer, const size_t index)
7272 : aliased_buffer_(aliased_buffer), index_(index) {}
7373
7474 Reference (const Reference& that)
7575 : aliased_buffer_(that.aliased_buffer_),
7676 index_ (that.index_) {
7777 }
7878
79- inline Reference& operator =(const NativeT& val) {
79+ Reference& operator =(const NativeT& val) {
8080 aliased_buffer_->SetValue (index_, val);
8181 return *this ;
8282 }
8383
84- inline Reference& operator =(const Reference& val) {
84+ Reference& operator =(const Reference& val) {
8585 return *this = static_cast <NativeT>(val);
8686 }
8787
8888 operator NativeT () const {
8989 return aliased_buffer_->GetValue (index_);
9090 }
9191
92- inline Reference& operator +=(const NativeT& val) {
92+ Reference& operator +=(const NativeT& val) {
9393 const NativeT current = aliased_buffer_->GetValue (index_);
9494 aliased_buffer_->SetValue (index_, current + val);
9595 return *this ;
9696 }
9797
98- inline Reference& operator +=(const Reference& val) {
98+ Reference& operator +=(const Reference& val) {
9999 return this ->operator +=(static_cast <NativeT>(val));
100100 }
101101
102- inline Reference& operator -=(const NativeT& val) {
102+ Reference& operator -=(const NativeT& val) {
103103 const NativeT current = aliased_buffer_->GetValue (index_);
104104 aliased_buffer_->SetValue (index_, current - val);
105105 return *this ;
106106 }
107107
108108 private:
109- AliasedBufferBase<NativeT, V8T> * aliased_buffer_;
109+ AliasedBufferBase* aliased_buffer_;
110110 size_t index_;
111111 };
112112
@@ -123,7 +123,7 @@ class AliasedBufferBase : public MemoryRetainer {
123123 * array becomes unreachable. Usually this means the caller must maintain
124124 * a JS reference to the typed array from JS object.
125125 */
126- inline void MakeWeak ();
126+ void MakeWeak ();
127127
128128 /* *
129129 * Get the underlying v8::ArrayBuffer underlying the TypedArray and
@@ -135,22 +135,22 @@ class AliasedBufferBase : public MemoryRetainer {
135135 * Get the underlying native buffer. Note that all reads/writes should occur
136136 * through the GetValue/SetValue/operator[] methods
137137 */
138- inline const NativeT* GetNativeBuffer () const ;
138+ const NativeT* GetNativeBuffer () const ;
139139
140140 /* *
141141 * Synonym for GetBuffer()
142142 */
143- inline const NativeT* operator *() const ;
143+ const NativeT* operator *() const ;
144144
145145 /* *
146146 * Set position index to given value.
147147 */
148- inline void SetValue (const size_t index, NativeT value);
148+ void SetValue (size_t index, NativeT value);
149149
150150 /* *
151151 * Get value at position index
152152 */
153- inline const NativeT GetValue (const size_t index) const ;
153+ const NativeT GetValue (size_t index) const ;
154154
155155 /* *
156156 * Effectively, a synonym for GetValue/SetValue
@@ -166,13 +166,13 @@ class AliasedBufferBase : public MemoryRetainer {
166166 // an owning `AliasedBufferBase`.
167167 void reserve (size_t new_capacity);
168168
169- inline size_t SelfSize () const override ;
169+ size_t SelfSize () const override ;
170170
171- inline const char * MemoryInfoName () const override ;
172- inline void MemoryInfo (node:: MemoryTracker* tracker) const override ;
171+ const char * MemoryInfoName () const override ;
172+ void MemoryInfo (MemoryTracker* tracker) const override ;
173173
174174 private:
175- inline bool is_valid () const ;
175+ bool is_valid () const ;
176176 v8::Isolate* isolate_ = nullptr ;
177177 size_t count_ = 0 ;
178178 size_t byte_offset_ = 0 ;
0 commit comments