GeezerVison is showing github.com — src: get binding data store directly from the realm · nodejs/node@d358317
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_realm-inl.h +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,14 +88,14 @@ inline T* Realm::AddBindingData(v8::Local<v8::Context> context, |
88 | 88 | // This won't compile if T is not a BaseObject subclass. |
89 | 89 | BaseObjectPtr<T> item = |
90 | 90 | MakeDetachedBaseObject<T>(this, target, std::forward<Args>(args)...); |
91 | | - BindingDataStore* map = |
92 | | - static_cast<BindingDataStore*>(context->GetAlignedPointerFromEmbedderData( |
93 | | - ContextEmbedderIndex::kBindingDataStoreIndex)); |
94 | | - DCHECK_NOT_NULL(map); |
| 91 | + DCHECK_EQ(context->GetAlignedPointerFromEmbedderData( |
| 92 | + ContextEmbedderIndex::kBindingDataStoreIndex), |
| 93 | + &binding_data_store_); |
95 | 94 | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); |
96 | 95 | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); |
97 | | - CHECK(!(*map)[binding_index]); // Should not insert the binding twice. |
98 | | - (*map)[binding_index] = item; |
| 96 | + // Should not insert the binding twice. |
| 97 | + CHECK(!binding_data_store_[binding_index]); |
| 98 | + binding_data_store_[binding_index] = item; |
99 | 99 | DCHECK_EQ(GetBindingData<T>(context), item.get()); |
100 | 100 | return item.get(); |
101 | 101 | } |
|