@@ -82,8 +82,8 @@ Local<String> BuiltinLoader::GetConfigString(Isolate* isolate) { |
82 | 82 | return config_.ToStringChecked(isolate); |
83 | 83 | } |
84 | 84 |
|
85 | | -std::vector<std::string> BuiltinLoader::GetBuiltinIds() const { |
86 | | - std::vector<std::string> ids; |
| 85 | +std::vector<std::string_view> BuiltinLoader::GetBuiltinIds() const { |
| 86 | + std::vector<std::string_view> ids; |
87 | 87 | auto source = source_.read(); |
88 | 88 | ids.reserve(source->size()); |
89 | 89 | for (auto const& x : *source) { |
@@ -95,7 +95,7 @@ std::vector<std::string> BuiltinLoader::GetBuiltinIds() const { |
95 | 95 | BuiltinLoader::BuiltinCategories BuiltinLoader::GetBuiltinCategories() const { |
96 | 96 | BuiltinCategories builtin_categories; |
97 | 97 |
|
98 | | - std::vector<std::string> prefixes = { |
| 98 | + const std::vector<std::string_view> prefixes = { |
99 | 99 | #if !HAVE_OPENSSL |
100 | 100 | "internal/crypto/", |
101 | 101 | "internal/debugger/", |
@@ -475,19 +475,19 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, |
475 | 475 | } |
476 | 476 |
|
477 | 477 | bool BuiltinLoader::CompileAllBuiltins(Local<Context> context) { |
478 | | - std::vector<std::string> ids = GetBuiltinIds(); |
| 478 | + std::vector<std::string_view> ids = GetBuiltinIds(); |
479 | 479 | bool all_succeeded = true; |
480 | 480 | std::string v8_tools_prefix = "internal/deps/v8/tools/"; |
481 | 481 | for (const auto& id : ids) { |
482 | 482 | if (id.compare(0, v8_tools_prefix.size(), v8_tools_prefix) == 0) { |
483 | 483 | continue; |
484 | 484 | } |
485 | 485 | v8::TryCatch bootstrapCatch(context->GetIsolate()); |
486 | | - USE(LookupAndCompile(context, id.c_str(), nullptr)); |
| 486 | + USE(LookupAndCompile(context, id.data(), nullptr)); |
487 | 487 | if (bootstrapCatch.HasCaught()) { |
488 | 488 | per_process::Debug(DebugCategory::CODE_CACHE, |
489 | 489 | "Failed to compile code cache for %s\n", |
490 | | - id.c_str()); |
| 490 | + id.data()); |
491 | 491 | all_succeeded = false; |
492 | 492 | PrintCaughtException(context->GetIsolate(), context, bootstrapCatch); |
493 | 493 | } |
@@ -607,7 +607,7 @@ void BuiltinLoader::BuiltinIdsGetter(Local<Name> property, |
607 | 607 | Environment* env = Environment::GetCurrent(info); |
608 | 608 | Isolate* isolate = env->isolate(); |
609 | 609 |
|
610 | | - std::vector<std::string> ids = env->builtin_loader()->GetBuiltinIds(); |
| 610 | + std::vector<std::string_view> ids = env->builtin_loader()->GetBuiltinIds(); |
611 | 611 | info.GetReturnValue().Set( |
612 | 612 | ToV8Value(isolate->GetCurrentContext(), ids).ToLocalChecked()); |
613 | 613 | } |
|