| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a34fe77 commit 840f509
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,8 +98,7 @@ std::string ModuleCacheKey::ToString() const { | |||
| 98 | 98 | } | |
| 99 | 99 | ||
| 100 | 100 | template <int elements_per_attribute> | |
| 101 | - ModuleCacheKey ModuleCacheKey::From(Local<Context> context, | ||
| 102 | - Local<String> specifier, | ||
| 101 | + ModuleCacheKey ModuleCacheKey::From(Local<String> specifier, | ||
| 103 | 102 | Local<FixedArray> import_attributes) { | |
| 104 | 103 | CHECK_EQ(import_attributes->Length() % elements_per_attribute, 0); | |
| 105 | 104 | Isolate* isolate = Isolate::GetCurrent(); | |
@@ -112,12 +111,11 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context, | |||
| 112 | 111 | ||
| 113 | 112 | for (int i = 0; i < import_attributes->Length(); | |
| 114 | 113 | i += elements_per_attribute) { | |
| 115 | - DCHECK(DataIsString(import_attributes->Get(context, i))); | ||
| 116 | - DCHECK(DataIsString(import_attributes->Get(context, i + 1))); | ||
| 114 | + DCHECK(DataIsString(import_attributes->Get(i))); | ||
| 115 | + DCHECK(DataIsString(import_attributes->Get(i + 1))); | ||
| 117 | 116 | ||
| 118 | - Local<String> v8_key = import_attributes->Get(context, i).As<String>(); | ||
| 119 | - Local<String> v8_value = | ||
| 120 | - import_attributes->Get(context, i + 1).As<String>(); | ||
| 117 | + Local<String> v8_key = import_attributes->Get(i).As<String>(); | ||
| 118 | + Local<String> v8_value = import_attributes->Get(i + 1).As<String>(); | ||
| 121 | 119 | Utf8Value key_utf8(isolate, v8_key); | |
| 122 | 120 | Utf8Value value_utf8(isolate, v8_value); | |
| 123 | 121 | ||
@@ -134,10 +132,8 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context, | |||
| 134 | 132 | return ModuleCacheKey{utf8_specifier.ToString(), attributes, hash}; | |
| 135 | 133 | } | |
| 136 | 134 | ||
| 137 | - ModuleCacheKey ModuleCacheKey::From(Local<Context> context, | ||
| 138 | - Local<ModuleRequest> v8_request) { | ||
| 139 | - return From( | ||
| 140 | - context, v8_request->GetSpecifier(), v8_request->GetImportAttributes()); | ||
| 135 | + ModuleCacheKey ModuleCacheKey::From(Local<ModuleRequest> v8_request) { | ||
| 136 | + return From(v8_request->GetSpecifier(), v8_request->GetImportAttributes()); | ||
| 141 | 137 | } | |
| 142 | 138 | ||
| 143 | 139 | ModuleWrap::ModuleWrap(Realm* realm, | |
@@ -577,8 +573,8 @@ static Local<Object> createImportAttributesContainer( | |||
| 577 | 573 | LocalVector<Value> values(isolate, num_attributes); | |
| 578 | 574 | ||
| 579 | 575 | for (int i = 0; i < raw_attributes->Length(); i += elements_per_attribute) { | |
| 580 | - Local<Data> key = raw_attributes->Get(realm->context(), i); | ||
| 581 | - Local<Data> value = raw_attributes->Get(realm->context(), i + 1); | ||
| 576 | + Local<Data> key = raw_attributes->Get(i); | ||
| 577 | + Local<Data> value = raw_attributes->Get(i + 1); | ||
| 582 | 578 | DCHECK(DataIsString(key)); | |
| 583 | 579 | DCHECK(DataIsString(value)); | |
| 584 | 580 | ||
@@ -601,9 +597,9 @@ static Local<Array> createModuleRequestsContainer( | |||
| 601 | 597 | LocalVector<Value> requests(isolate, raw_requests->Length()); | |
| 602 | 598 | ||
| 603 | 599 | for (int i = 0; i < raw_requests->Length(); i++) { | |
| 604 | - DCHECK(raw_requests->Get(context, i)->IsModuleRequest()); | ||
| 600 | + DCHECK(raw_requests->Get(i)->IsModuleRequest()); | ||
| 605 | 601 | Local<ModuleRequest> module_request = | |
| 606 | - raw_requests->Get(realm->context(), i).As<ModuleRequest>(); | ||
| 602 | + raw_requests->Get(i).As<ModuleRequest>(); | ||
| 607 | 603 | ||
| 608 | 604 | Local<String> specifier = module_request->GetSpecifier(); | |
| 609 | 605 | ||
@@ -691,8 +687,8 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) { | |||
| 691 | 687 | // TODO(joyeecheung): merge this with the serializeKey() in module_map.js. | |
| 692 | 688 | // This currently doesn't sort the import attributes. | |
| 693 | 689 | Local<Value> module_value = modules_vector[i].Get(isolate); | |
| 694 | - ModuleCacheKey module_cache_key = ModuleCacheKey::From( | ||
| 695 | - context, requests->Get(context, i).As<ModuleRequest>()); | ||
| 690 | + ModuleCacheKey module_cache_key = | ||
| 691 | + ModuleCacheKey::From(requests->Get(i).As<ModuleRequest>()); | ||
| 696 | 692 | auto it = module_request_map.find(module_cache_key); | |
| 697 | 693 | if (it == module_request_map.end()) { | |
| 698 | 694 | // This is the first request with this identity, record it - any mismatch | |
@@ -1085,12 +1081,11 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback( | |||
| 1085 | 1081 | return module_source_object.As<Object>(); | |
| 1086 | 1082 | } | |
| 1087 | 1083 | ||
| 1088 | - static std::string GetSpecifierFromModuleRequest(Local<Context> context, | ||
| 1089 | - Local<Module> referrer, | ||
| 1084 | + static std::string GetSpecifierFromModuleRequest(Local<Module> referrer, | ||
| 1090 | 1085 | size_t module_request_index) { | |
| 1091 | 1086 | Local<ModuleRequest> raw_request = | |
| 1092 | 1087 | referrer->GetModuleRequests() | |
| 1093 | - ->Get(context, static_cast<int>(module_request_index)) | ||
| 1088 | + ->Get(static_cast<int>(module_request_index)) | ||
| 1094 | 1089 | .As<ModuleRequest>(); | |
| 1095 | 1090 | Local<String> specifier = raw_request->GetSpecifier(); | |
| 1096 | 1091 | Utf8Value specifier_utf8(Isolate::GetCurrent(), specifier); | |
@@ -1113,14 +1108,14 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(Local<Context> context, | |||
| 1113 | 1108 | ModuleWrap* dependent = ModuleWrap::GetFromModule(env, referrer); | |
| 1114 | 1109 | if (dependent == nullptr) { | |
| 1115 | 1110 | std::string specifier = | |
| 1116 | - GetSpecifierFromModuleRequest(context, referrer, module_request_index); | ||
| 1111 | + GetSpecifierFromModuleRequest(referrer, module_request_index); | ||
| 1117 | 1112 | THROW_ERR_VM_MODULE_LINK_FAILURE( | |
| 1118 | 1113 | env, "request for '%s' is from invalid module", specifier); | |
| 1119 | 1114 | return Nothing<ModuleWrap*>(); | |
| 1120 | 1115 | } | |
| 1121 | 1116 | if (!dependent->IsLinked()) { | |
| 1122 | 1117 | std::string specifier = | |
| 1123 | - GetSpecifierFromModuleRequest(context, referrer, module_request_index); | ||
| 1118 | + GetSpecifierFromModuleRequest(referrer, module_request_index); | ||
| 1124 | 1119 | THROW_ERR_VM_MODULE_LINK_FAILURE(env, | |
| 1125 | 1120 | "request for '%s' can not be resolved on " | |
| 1126 | 1121 | "module '%s' that is not linked", | |
@@ -1170,7 +1165,7 @@ static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase( | |||
| 1170 | 1165 | // If the host-defined options are empty, get the referrer id symbol | |
| 1171 | 1166 | // from the realm global object. | |
| 1172 | 1167 | if (options->Length() == HostDefinedOptions::kLength) { | |
| 1173 | - id = options->Get(context, HostDefinedOptions::kID).As<Symbol>(); | ||
| 1168 | + id = options->Get(HostDefinedOptions::kID).As<Symbol>(); | ||
| 1174 | 1169 | } else if (!context->Global() | |
| 1175 | 1170 | ->GetPrivate(context, env->host_defined_option_symbol()) | |
| 1176 | 1171 | .ToLocal(&id)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,11 +63,9 @@ struct ModuleCacheKey : public MemoryRetainer { | |||
| 63 | 63 | std::string ToString() const; | |
| 64 | 64 | ||
| 65 | 65 | template <int elements_per_attribute = 3> | |
| 66 | - static ModuleCacheKey From(v8::Local<v8::Context> context, | ||
| 67 | - v8::Local<v8::String> specifier, | ||
| 66 | + static ModuleCacheKey From(v8::Local<v8::String> specifier, | ||
| 68 | 67 | v8::Local<v8::FixedArray> import_attributes); | |
| 69 | - static ModuleCacheKey From(v8::Local<v8::Context> context, | ||
| 70 | - v8::Local<v8::ModuleRequest> v8_request); | ||
| 68 | + static ModuleCacheKey From(v8::Local<v8::ModuleRequest> v8_request); | ||
| 71 | 69 | ||
| 72 | 70 | struct Hash { | |
| 73 | 71 | std::size_t operator()(const ModuleCacheKey& request) const { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -744,7 +744,7 @@ MaybeLocal<Module> BuiltinLoader::LoadBuiltinSourceTextModule(Realm* realm, | |||
| 744 | 744 | // Pre-fetch all dependencies. | |
| 745 | 745 | if (requests->Length() > 0) { | |
| 746 | 746 | for (int i = 0; i < requests->Length(); i++) { | |
| 747 | - Local<ModuleRequest> req = requests->Get(context, i).As<ModuleRequest>(); | ||
| 747 | + Local<ModuleRequest> req = requests->Get(i).As<ModuleRequest>(); | ||
| 748 | 748 | std::string specifier = | |
| 749 | 749 | Utf8Value(isolate, req->GetSpecifier()).ToString(); | |
| 750 | 750 | std::string resolved_id = ResolveRequestForBuiltin(specifier); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments