@@ -246,7 +246,7 @@ bool SeaResource::use_code_cache() const {
246246 return static_cast <bool >(flags & SeaFlags::kUseCodeCache );
247247}
248248
249- SeaResource FindSingleExecutableResource () {
249+ const SeaResource& FindSingleExecutableResource () {
250250 static const SeaResource sea_resource = []() -> SeaResource {
251251 std::string_view blob = FindSingleExecutableBlob ();
252252 per_process::Debug (DebugCategory::SEA ,
@@ -266,7 +266,7 @@ void IsSea(const FunctionCallbackInfo<Value>& args) {
266266void IsVfsEnabled (const FunctionCallbackInfo<Value>& args) {
267267 bool enabled = false ;
268268 if (IsSingleExecutable ()) {
269- SeaResource sea_resource = FindSingleExecutableResource ();
269+ const SeaResource& sea_resource = FindSingleExecutableResource ();
270270 enabled = static_cast <bool >(sea_resource.flags & SeaFlags::kEnableVfs );
271271 }
272272 args.GetReturnValue ().Set (enabled);
@@ -285,7 +285,7 @@ void IsExperimentalSeaWarningNeeded(const FunctionCallbackInfo<Value>& args) {
285285 return ;
286286 }
287287
288- SeaResource sea_resource = FindSingleExecutableResource ();
288+ const SeaResource& sea_resource = FindSingleExecutableResource ();
289289 args.GetReturnValue ().Set (!static_cast <bool >(
290290 sea_resource.flags & SeaFlags::kDisableExperimentalSeaWarning ));
291291}
@@ -300,7 +300,7 @@ std::tuple<int, char**> FixupArgsForSEA(int argc,
300300 static std::vector<std::string> exec_argv_storage;
301301 static std::vector<std::string> cli_extension_args;
302302
303- SeaResource sea_resource = FindSingleExecutableResource ();
303+ const SeaResource& sea_resource = FindSingleExecutableResource ();
304304
305305 new_argv.clear ();
306306 exec_argv_storage.clear ();
@@ -868,7 +868,7 @@ void GetAsset(const FunctionCallbackInfo<Value>& args) {
868868 CHECK_EQ (args.Length (), 1 );
869869 CHECK (args[0 ]->IsString ());
870870 Utf8Value key (args.GetIsolate (), args[0 ]);
871- SeaResource sea_resource = FindSingleExecutableResource ();
871+ const SeaResource& sea_resource = FindSingleExecutableResource ();
872872 if (sea_resource.assets .empty ()) {
873873 return ;
874874 }
@@ -892,7 +892,7 @@ void GetAsset(const FunctionCallbackInfo<Value>& args) {
892892void GetAssetKeys (const FunctionCallbackInfo<Value>& args) {
893893 CHECK_EQ (args.Length (), 0 );
894894 Isolate* isolate = args.GetIsolate ();
895- SeaResource sea_resource = FindSingleExecutableResource ();
895+ const SeaResource& sea_resource = FindSingleExecutableResource ();
896896
897897 Local<Context> context = isolate->GetCurrentContext ();
898898 LocalVector<Value> keys (isolate);
@@ -914,7 +914,7 @@ MaybeLocal<Value> LoadSingleExecutableApplication(
914914 // env->context() is entered.
915915 Environment* env = info.env ();
916916 Local<Context> context = env->context ();
917- SeaResource sea = FindSingleExecutableResource ();
917+ const SeaResource& sea = FindSingleExecutableResource ();
918918
919919 CHECK (!sea.use_snapshot ());
920920 // TODO(joyeecheung): this should be an external string. Refactor UnionBytes
@@ -936,7 +936,7 @@ bool MaybeLoadSingleExecutableApplication(Environment* env) {
936936 return false ;
937937 }
938938
939- SeaResource sea = FindSingleExecutableResource ();
939+ const SeaResource& sea = FindSingleExecutableResource ();
940940
941941 if (sea.use_snapshot ()) {
942942 // The SEA preparation blob building process should already enforce this,
@@ -962,7 +962,7 @@ void Initialize(Local<Object> target,
962962 Isolate* isolate = env->isolate ();
963963
964964 if (IsSingleExecutable ()) {
965- SeaResource sea_resource = FindSingleExecutableResource ();
965+ const SeaResource& sea_resource = FindSingleExecutableResource ();
966966 // Expose the main script path recorded in the SEA config so the VFS
967967 // integration can place the main script at the mount point root.
968968 if (static_cast <bool >(sea_resource.flags & SeaFlags::kEnableVfs )) {
0 commit comments