| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7f08e02 commit 437bb25
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,11 +115,7 @@ IsolateData* CreateIsolateData(Isolate* isolate, | |||
| 115 | 115 | uv_loop_t* loop, | |
| 116 | 116 | MultiIsolatePlatform* platform, | |
| 117 | 117 | ArrayBufferAllocator* allocator) { | |
| 118 | - return new IsolateData( | ||
| 119 | - isolate, | ||
| 120 | - loop, | ||
| 121 | - platform, | ||
| 122 | - allocator != nullptr ? allocator->zero_fill_field() : nullptr); | ||
| 118 | + return new IsolateData(isolate, loop, platform, allocator); | ||
| 123 | 119 | } | |
| 124 | 120 | ||
| 125 | 121 | void FreeIsolateData(IsolateData* isolate_data) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,8 +49,16 @@ inline uv_loop_t* IsolateData::event_loop() const { | |||
| 49 | 49 | return event_loop_; | |
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | - inline uint32_t* IsolateData::zero_fill_field() const { | ||
| 53 | - return zero_fill_field_; | ||
| 52 | + inline bool IsolateData::uses_node_allocator() const { | ||
| 53 | + return uses_node_allocator_; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + inline v8::ArrayBuffer::Allocator* IsolateData::allocator() const { | ||
| 57 | + return allocator_; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + inline ArrayBufferAllocator* IsolateData::node_allocator() const { | ||
| 61 | + return node_allocator_; | ||
| 54 | 62 | } | |
| 55 | 63 | ||
| 56 | 64 | inline MultiIsolatePlatform* IsolateData::platform() const { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,11 +74,14 @@ void* const Environment::kNodeContextTagPtr = const_cast<void*>( | |||
| 74 | 74 | IsolateData::IsolateData(Isolate* isolate, | |
| 75 | 75 | uv_loop_t* event_loop, | |
| 76 | 76 | MultiIsolatePlatform* platform, | |
| 77 | - uint32_t* zero_fill_field) : | ||
| 78 | - isolate_(isolate), | ||
| 79 | - event_loop_(event_loop), | ||
| 80 | - zero_fill_field_(zero_fill_field), | ||
| 81 | - platform_(platform) { | ||
| 77 | + ArrayBufferAllocator* node_allocator) | ||
| 78 | + : isolate_(isolate), | ||
| 79 | + event_loop_(event_loop), | ||
| 80 | + allocator_(isolate->GetArrayBufferAllocator()), | ||
| 81 | + node_allocator_(node_allocator), | ||
| 82 | + uses_node_allocator_(allocator_ == node_allocator_), | ||
| 83 | + platform_(platform) { | ||
| 84 | + CHECK_NOT_NULL(allocator_); | ||
| 82 | 85 | if (platform_ != nullptr) | |
| 83 | 86 | platform_->RegisterIsolate(isolate_, event_loop); | |
| 84 | 87 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -392,16 +392,20 @@ class Environment; | |||
| 392 | 392 | ||
| 393 | 393 | class IsolateData { | |
| 394 | 394 | public: | |
| 395 | - IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop, | ||
| 395 | + IsolateData(v8::Isolate* isolate, | ||
| 396 | + uv_loop_t* event_loop, | ||
| 396 | 397 | MultiIsolatePlatform* platform = nullptr, | |
| 397 | - uint32_t* zero_fill_field = nullptr); | ||
| 398 | + ArrayBufferAllocator* node_allocator = nullptr); | ||
| 398 | 399 | ~IsolateData(); | |
| 399 | 400 | inline uv_loop_t* event_loop() const; | |
| 400 | - inline uint32_t* zero_fill_field() const; | ||
| 401 | 401 | inline MultiIsolatePlatform* platform() const; | |
| 402 | 402 | inline std::shared_ptr<PerIsolateOptions> options(); | |
| 403 | 403 | inline void set_options(std::shared_ptr<PerIsolateOptions> options); | |
| 404 | 404 | ||
| 405 | + inline bool uses_node_allocator() const; | ||
| 406 | + inline v8::ArrayBuffer::Allocator* allocator() const; | ||
| 407 | + inline ArrayBufferAllocator* node_allocator() const; | ||
| 408 | + | ||
| 405 | 409 | #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) | |
| 406 | 410 | #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) | |
| 407 | 411 | #define VS(PropertyName, StringValue) V(v8::String, PropertyName) | |
@@ -434,7 +438,9 @@ class IsolateData { | |||
| 434 | 438 | ||
| 435 | 439 | v8::Isolate* const isolate_; | |
| 436 | 440 | uv_loop_t* const event_loop_; | |
| 437 | - uint32_t* const zero_fill_field_; | ||
| 441 | + v8::ArrayBuffer::Allocator* const allocator_; | ||
| 442 | + ArrayBufferAllocator* const node_allocator_; | ||
| 443 | + const bool uses_node_allocator_; | ||
| 438 | 444 | MultiIsolatePlatform* platform_; | |
| 439 | 445 | std::shared_ptr<PerIsolateOptions> options_; | |
| 440 | 446 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments