@@ -82,8 +82,8 @@ Local<String> BuiltinLoader::GetConfigString(Isolate* isolate) {
8282  return  config_.ToStringChecked (isolate);
8383}
8484
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;
8787  auto  source = source_.read ();
8888  ids.reserve (source->size ());
8989  for  (auto  const & x : *source) {
@@ -95,7 +95,7 @@ std::vector<std::string> BuiltinLoader::GetBuiltinIds() const {
9595BuiltinLoader::BuiltinCategories BuiltinLoader::GetBuiltinCategories () const  {
9696  BuiltinCategories builtin_categories;
9797
98-   std::vector<std::string > prefixes = {
98+   const   std::vector<std::string_view > prefixes = {
9999#if  !HAVE_OPENSSL
100100    " internal/crypto/"  ,
101101    " internal/debugger/"  ,
@@ -475,19 +475,19 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
475475}
476476
477477bool  BuiltinLoader::CompileAllBuiltins (Local<Context> context) {
478-   std::vector<std::string > ids = GetBuiltinIds ();
478+   std::vector<std::string_view > ids = GetBuiltinIds ();
479479  bool  all_succeeded = true ;
480480  std::string v8_tools_prefix = " internal/deps/v8/tools/"  ;
481481  for  (const  auto & id : ids) {
482482    if  (id.compare (0 , v8_tools_prefix.size (), v8_tools_prefix) == 0 ) {
483483      continue ;
484484    }
485485    v8::TryCatch bootstrapCatch (context->GetIsolate ());
486-     USE (LookupAndCompile (context, id.c_str (), nullptr ));
486+     USE (LookupAndCompile (context, id.data (), nullptr ));
487487    if  (bootstrapCatch.HasCaught ()) {
488488      per_process::Debug (DebugCategory::CODE_CACHE,
489489                         " Failed to compile code cache for %s\n "  ,
490-                          id.c_str ());
490+                          id.data ());
491491      all_succeeded = false ;
492492      PrintCaughtException (context->GetIsolate (), context, bootstrapCatch);
493493    }
@@ -607,7 +607,7 @@ void BuiltinLoader::BuiltinIdsGetter(Local<Name> property,
607607  Environment* env = Environment::GetCurrent (info);
608608  Isolate* isolate = env->isolate ();
609609
610-   std::vector<std::string > ids = env->builtin_loader ()->GetBuiltinIds ();
610+   std::vector<std::string_view > ids = env->builtin_loader ()->GetBuiltinIds ();
611611  info.GetReturnValue ().Set (
612612      ToV8Value (isolate->GetCurrentContext (), ids).ToLocalChecked ());
613613}
0 commit comments