@@ -158,23 +158,12 @@ void Initialize(Local<Object> target,
158
158
" updateHeapStatisticsArrayBuffer" ,
159
159
UpdateHeapStatisticsArrayBuffer);
160
160
161
- env->set_heap_statistics_buffer (new double [kHeapStatisticsPropertiesCount ]);
162
-
163
161
const size_t heap_statistics_buffer_byte_length =
164
162
sizeof (*env->heap_statistics_buffer ()) * kHeapStatisticsPropertiesCount ;
165
163
166
- std::unique_ptr<BackingStore> heap_statistics_backing =
167
- ArrayBuffer::NewBackingStore (env->heap_statistics_buffer (),
168
- heap_statistics_buffer_byte_length,
169
- [](void *, size_t , void *){},
170
- nullptr );
171
164
Local<ArrayBuffer> heap_statistics_ab =
172
- ArrayBuffer::New (env->isolate (),
173
- std::move (heap_statistics_backing));
174
- // TODO(thangktran): drop this check when V8 is pumped to 8.0 .
175
- if (!heap_statistics_ab->IsExternal ())
176
- heap_statistics_ab->Externalize (
177
- heap_statistics_ab->GetBackingStore ());
165
+ ArrayBuffer::New (env->isolate (), heap_statistics_buffer_byte_length);
166
+ env->set_heap_statistics_buffer (heap_statistics_ab->GetBackingStore ());
178
167
target->Set (env->context (),
179
168
FIXED_ONE_BYTE_STRING (env->isolate (),
180
169
" heapStatisticsArrayBuffer" ),
@@ -193,25 +182,15 @@ void Initialize(Local<Object> target,
193
182
" updateHeapCodeStatisticsArrayBuffer" ,
194
183
UpdateHeapCodeStatisticsArrayBuffer);
195
184
196
- env->set_heap_code_statistics_buffer (
197
- new double [kHeapCodeStatisticsPropertiesCount ]);
198
-
199
185
const size_t heap_code_statistics_buffer_byte_length =
200
186
sizeof (*env->heap_code_statistics_buffer ())
201
187
* kHeapCodeStatisticsPropertiesCount ;
202
188
203
- std::unique_ptr<BackingStore> heap_code_statistics_backing =
204
- ArrayBuffer::NewBackingStore (env->heap_code_statistics_buffer (),
205
- heap_code_statistics_buffer_byte_length,
206
- [](void *, size_t , void *){},
207
- nullptr );
208
189
Local<ArrayBuffer> heap_code_statistics_ab =
209
190
ArrayBuffer::New (env->isolate (),
210
- std::move (heap_code_statistics_backing));
211
- // TODO(thangktran): drop this check when V8 is pumped to 8.0 .
212
- if (!heap_code_statistics_ab->IsExternal ())
213
- heap_code_statistics_ab->Externalize (
214
- heap_code_statistics_ab->GetBackingStore ());
191
+ heap_code_statistics_buffer_byte_length);
192
+ env->set_heap_code_statistics_buffer (
193
+ heap_code_statistics_ab->GetBackingStore ());
215
194
target->Set (env->context (),
216
195
FIXED_ONE_BYTE_STRING (env->isolate (),
217
196
" heapCodeStatisticsArrayBuffer" ),
@@ -257,26 +236,16 @@ void Initialize(Local<Object> target,
257
236
" updateHeapSpaceStatisticsArrayBuffer" ,
258
237
UpdateHeapSpaceStatisticsBuffer);
259
238
260
- env->set_heap_space_statistics_buffer (
261
- new double [kHeapSpaceStatisticsPropertiesCount * number_of_heap_spaces]);
262
-
263
239
const size_t heap_space_statistics_buffer_byte_length =
264
240
sizeof (*env->heap_space_statistics_buffer ()) *
265
241
kHeapSpaceStatisticsPropertiesCount *
266
242
number_of_heap_spaces;
267
243
268
- std::unique_ptr<BackingStore> heap_space_statistics_backing =
269
- ArrayBuffer::NewBackingStore (env->heap_space_statistics_buffer (),
270
- heap_space_statistics_buffer_byte_length,
271
- [](void *, size_t , void *){},
272
- nullptr );
273
244
Local<ArrayBuffer> heap_space_statistics_ab =
274
245
ArrayBuffer::New (env->isolate (),
275
- std::move (heap_space_statistics_backing));
276
- // TODO(thangktran): drop this check when V8 is pumped to 8.0 .
277
- if (!heap_space_statistics_ab->IsExternal ())
278
- heap_space_statistics_ab->Externalize (
279
- heap_space_statistics_ab->GetBackingStore ());
246
+ heap_space_statistics_buffer_byte_length);
247
+ env->set_heap_space_statistics_buffer (
248
+ heap_space_statistics_ab->GetBackingStore ());
280
249
target->Set (env->context (),
281
250
FIXED_ONE_BYTE_STRING (env->isolate (),
282
251
" heapSpaceStatisticsArrayBuffer" ),
0 commit comments