| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2fb007f commit 2b6a82d
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ namespace encoding_binding { | |||
| 15 | 15 | ||
| 16 | 16 | using v8::ArrayBuffer; | |
| 17 | 17 | using v8::BackingStore; | |
| 18 | + using v8::BackingStoreInitializationMode; | ||
| 18 | 19 | using v8::Context; | |
| 19 | 20 | using v8::FunctionCallbackInfo; | |
| 20 | 21 | using v8::Isolate; | |
@@ -124,9 +125,8 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo<Value>& args) { | |||
| 124 | 125 | ||
| 125 | 126 | Local<ArrayBuffer> ab; | |
| 126 | 127 | { | |
| 127 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 128 | - std::unique_ptr<BackingStore> bs = | ||
| 129 | - ArrayBuffer::NewBackingStore(isolate, length); | ||
| 128 | + std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore( | ||
| 129 | + isolate, length, BackingStoreInitializationMode::kUninitialized); | ||
| 130 | 130 | ||
| 131 | 131 | CHECK(bs); | |
| 132 | 132 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,6 +39,9 @@ namespace node { | |||
| 39 | 39 | ||
| 40 | 40 | using errors::TryCatchScope; | |
| 41 | 41 | using v8::Array; | |
| 42 | + using v8::ArrayBuffer; | ||
| 43 | + using v8::BackingStore; | ||
| 44 | + using v8::BackingStoreInitializationMode; | ||
| 42 | 45 | using v8::Boolean; | |
| 43 | 46 | using v8::Context; | |
| 44 | 47 | using v8::CppHeap; | |
@@ -742,17 +745,18 @@ void Environment::add_refs(int64_t diff) { | |||
| 742 | 745 | } | |
| 743 | 746 | ||
| 744 | 747 | uv_buf_t Environment::allocate_managed_buffer(const size_t suggested_size) { | |
| 745 | - NoArrayBufferZeroFillScope no_zero_fill_scope(isolate_data()); | ||
| 746 | - std::unique_ptr<v8::BackingStore> bs = | ||
| 747 | - v8::ArrayBuffer::NewBackingStore(isolate(), suggested_size); | ||
| 748 | + std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore( | ||
| 749 | + isolate(), | ||
| 750 | + suggested_size, | ||
| 751 | + BackingStoreInitializationMode::kUninitialized); | ||
| 748 | 752 | uv_buf_t buf = uv_buf_init(static_cast<char*>(bs->Data()), bs->ByteLength()); | |
| 749 | 753 | released_allocated_buffers_.emplace(buf.base, std::move(bs)); | |
| 750 | 754 | return buf; | |
| 751 | 755 | } | |
| 752 | 756 | ||
| 753 | - std::unique_ptr<v8::BackingStore> Environment::release_managed_buffer( | ||
| 757 | + std::unique_ptr<BackingStore> Environment::release_managed_buffer( | ||
| 754 | 758 | const uv_buf_t& buf) { | |
| 755 | - std::unique_ptr<v8::BackingStore> bs; | ||
| 759 | + std::unique_ptr<BackingStore> bs; | ||
| 756 | 760 | if (buf.base != nullptr) { | |
| 757 | 761 | auto it = released_allocated_buffers_.find(buf.base); | |
| 758 | 762 | CHECK_NE(it, released_allocated_buffers_.end()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,6 +58,7 @@ namespace Buffer { | |||
| 58 | 58 | using v8::ArrayBuffer; | |
| 59 | 59 | using v8::ArrayBufferView; | |
| 60 | 60 | using v8::BackingStore; | |
| 61 | + using v8::BackingStoreInitializationMode; | ||
| 61 | 62 | using v8::Context; | |
| 62 | 63 | using v8::EscapableHandleScope; | |
| 63 | 64 | using v8::FastApiTypedArray; | |
@@ -372,9 +373,8 @@ MaybeLocal<Object> New(Environment* env, size_t length) { | |||
| 372 | 373 | ||
| 373 | 374 | Local<ArrayBuffer> ab; | |
| 374 | 375 | { | |
| 375 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 376 | - std::unique_ptr<BackingStore> bs = | ||
| 377 | - ArrayBuffer::NewBackingStore(isolate, length); | ||
| 376 | + std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore( | ||
| 377 | + isolate, length, BackingStoreInitializationMode::kUninitialized); | ||
| 378 | 378 | ||
| 379 | 379 | CHECK(bs); | |
| 380 | 380 | ||
@@ -413,18 +413,14 @@ MaybeLocal<Object> Copy(Environment* env, const char* data, size_t length) { | |||
| 413 | 413 | return Local<Object>(); | |
| 414 | 414 | } | |
| 415 | 415 | ||
| 416 | - Local<ArrayBuffer> ab; | ||
| 417 | - { | ||
| 418 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 419 | - std::unique_ptr<BackingStore> bs = | ||
| 420 | - ArrayBuffer::NewBackingStore(isolate, length); | ||
| 416 | + std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore( | ||
| 417 | + isolate, length, BackingStoreInitializationMode::kUninitialized); | ||
| 421 | 418 | ||
| 422 | - CHECK(bs); | ||
| 419 | + CHECK(bs); | ||
| 423 | 420 | ||
| 424 | - memcpy(bs->Data(), data, length); | ||
| 421 | + memcpy(bs->Data(), data, length); | ||
| 425 | 422 | ||
| 426 | - ab = ArrayBuffer::New(isolate, std::move(bs)); | ||
| 427 | - } | ||
| 423 | + Local<ArrayBuffer> ab = ArrayBuffer::New(isolate, std::move(bs)); | ||
| 428 | 424 | ||
| 429 | 425 | MaybeLocal<Object> obj = | |
| 430 | 426 | New(env, ab, 0, ab->ByteLength()) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ using v8::Array; | |||
| 27 | 27 | using v8::ArrayBuffer; | |
| 28 | 28 | using v8::ArrayBufferView; | |
| 29 | 29 | using v8::BackingStore; | |
| 30 | + using v8::BackingStoreInitializationMode; | ||
| 30 | 31 | using v8::Boolean; | |
| 31 | 32 | using v8::Context; | |
| 32 | 33 | using v8::EscapableHandleScope; | |
@@ -292,11 +293,10 @@ Local<Value> Http2Settings::Pack( | |||
| 292 | 293 | size_t count, | |
| 293 | 294 | const nghttp2_settings_entry* entries) { | |
| 294 | 295 | EscapableHandleScope scope(env->isolate()); | |
| 295 | - std::unique_ptr<BackingStore> bs; | ||
| 296 | - { | ||
| 297 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 298 | - bs = ArrayBuffer::NewBackingStore(env->isolate(), count * 6); | ||
| 299 | - } | ||
| 296 | + std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore( | ||
| 297 | + env->isolate(), | ||
| 298 | + count * 6, | ||
| 299 | + BackingStoreInitializationMode::kUninitialized); | ||
| 300 | 300 | if (nghttp2_pack_settings_payload(static_cast<uint8_t*>(bs->Data()), | |
| 301 | 301 | bs->ByteLength(), | |
| 302 | 302 | entries, | |
@@ -457,13 +457,11 @@ Origins::Origins( | |||
| 457 | 457 | return; | |
| 458 | 458 | } | |
| 459 | 459 | ||
| 460 | - { | ||
| 461 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 462 | - bs_ = ArrayBuffer::NewBackingStore(env->isolate(), | ||
| 463 | - alignof(nghttp2_origin_entry) - 1 + | ||
| 464 | - count_ * sizeof(nghttp2_origin_entry) + | ||
| 465 | - origin_string_len); | ||
| 466 | - } | ||
| 460 | + bs_ = ArrayBuffer::NewBackingStore( | ||
| 461 | + env->isolate(), | ||
| 462 | + alignof(nghttp2_origin_entry) - 1 + | ||
| 463 | + count_ * sizeof(nghttp2_origin_entry) + origin_string_len, | ||
| 464 | + BackingStoreInitializationMode::kUninitialized); | ||
| 467 | 465 | ||
| 468 | 466 | // Make sure the start address is aligned appropriately for an nghttp2_nv*. | |
| 469 | 467 | char* start = nbytes::AlignUp(static_cast<char*>(bs_->Data()), | |
@@ -2090,12 +2088,10 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { | |||
| 2090 | 2088 | // happen, we concatenate the data we received with the already-stored | |
| 2091 | 2089 | // pending input data, slicing off the already processed part. | |
| 2092 | 2090 | size_t pending_len = stream_buf_.len - stream_buf_offset_; | |
| 2093 | - std::unique_ptr<BackingStore> new_bs; | ||
| 2094 | - { | ||
| 2095 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); | ||
| 2096 | - new_bs = ArrayBuffer::NewBackingStore(env()->isolate(), | ||
| 2097 | - pending_len + nread); | ||
| 2098 | - } | ||
| 2091 | + std::unique_ptr<BackingStore> new_bs = ArrayBuffer::NewBackingStore( | ||
| 2092 | + env()->isolate(), | ||
| 2093 | + pending_len + nread, | ||
| 2094 | + BackingStoreInitializationMode::kUninitialized); | ||
| 2099 | 2095 | memcpy(static_cast<char*>(new_bs->Data()), | |
| 2100 | 2096 | stream_buf_.base + stream_buf_offset_, | |
| 2101 | 2097 | pending_len); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ namespace node { | |||
| 19 | 19 | using v8::Array; | |
| 20 | 20 | using v8::ArrayBuffer; | |
| 21 | 21 | using v8::BackingStore; | |
| 22 | + using v8::BackingStoreInitializationMode; | ||
| 22 | 23 | using v8::ConstructorBehavior; | |
| 23 | 24 | using v8::Context; | |
| 24 | 25 | using v8::DontDelete; | |
@@ -243,8 +244,8 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { | |||
| 243 | 244 | ||
| 244 | 245 | std::unique_ptr<BackingStore> bs; | |
| 245 | 246 | if (storage_size > 0) { | |
| 246 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 247 | - bs = ArrayBuffer::NewBackingStore(isolate, storage_size); | ||
| 247 | + bs = ArrayBuffer::NewBackingStore( | ||
| 248 | + isolate, storage_size, BackingStoreInitializationMode::kUninitialized); | ||
| 248 | 249 | } | |
| 249 | 250 | ||
| 250 | 251 | offset = 0; | |
@@ -398,14 +399,14 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) { | |||
| 398 | 399 | ||
| 399 | 400 | if (try_write) { | |
| 400 | 401 | // Copy partial data | |
| 401 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 402 | - bs = ArrayBuffer::NewBackingStore(isolate, buf.len); | ||
| 402 | + bs = ArrayBuffer::NewBackingStore( | ||
| 403 | + isolate, buf.len, BackingStoreInitializationMode::kUninitialized); | ||
| 403 | 404 | memcpy(static_cast<char*>(bs->Data()), buf.base, buf.len); | |
| 404 | 405 | data_size = buf.len; | |
| 405 | 406 | } else { | |
| 406 | 407 | // Write it | |
| 407 | - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); | ||
| 408 | - bs = ArrayBuffer::NewBackingStore(isolate, storage_size); | ||
| 408 | + bs = ArrayBuffer::NewBackingStore( | ||
| 409 | + isolate, storage_size, BackingStoreInitializationMode::kUninitialized); | ||
| 409 | 410 | data_size = StringBytes::Write(isolate, | |
| 410 | 411 | static_cast<char*>(bs->Data()), | |
| 411 | 412 | storage_size, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments