@@ -358,7 +358,7 @@ Local<v8::FunctionTemplate> NewFunctionTemplate(
358358
359359void SetMethod (Local<v8::Context> context,
360360 Local<v8::Object> that,
361- const char * name,
361+ const std::string_view name,
362362 v8::FunctionCallback callback) {
363363 Isolate* isolate = context->GetIsolate ();
364364 Local<v8::Function> function =
@@ -372,14 +372,14 @@ void SetMethod(Local<v8::Context> context,
372372 // kInternalized strings are created in the old space.
373373 const v8::NewStringType type = v8::NewStringType::kInternalized ;
374374 Local<v8::String> name_string =
375- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
375+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
376376 that->Set (context, name_string, function).Check ();
377377 function->SetName (name_string); // NODE_SET_METHOD() compatibility.
378378}
379379
380380void SetMethod (v8::Isolate* isolate,
381381 v8::Local<v8::Template> that,
382- const char * name,
382+ const std::string_view name,
383383 v8::FunctionCallback callback) {
384384 Local<v8::FunctionTemplate> t =
385385 NewFunctionTemplate (isolate,
@@ -390,13 +390,13 @@ void SetMethod(v8::Isolate* isolate,
390390 // kInternalized strings are created in the old space.
391391 const v8::NewStringType type = v8::NewStringType::kInternalized ;
392392 Local<v8::String> name_string =
393- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
393+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
394394 that->Set (name_string, t);
395395}
396396
397397void SetFastMethod (Isolate* isolate,
398398 Local<Template> that,
399- const char * name,
399+ const std::string_view name,
400400 v8::FunctionCallback slow_callback,
401401 const v8::CFunction* c_function) {
402402 Local<v8::FunctionTemplate> t =
@@ -409,13 +409,13 @@ void SetFastMethod(Isolate* isolate,
409409 // kInternalized strings are created in the old space.
410410 const v8::NewStringType type = v8::NewStringType::kInternalized ;
411411 Local<v8::String> name_string =
412- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
412+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
413413 that->Set (name_string, t);
414414}
415415
416416void SetFastMethod (Local<v8::Context> context,
417417 Local<v8::Object> that,
418- const char * name,
418+ const std::string_view name,
419419 v8::FunctionCallback slow_callback,
420420 const v8::CFunction* c_function) {
421421 Isolate* isolate = context->GetIsolate ();
@@ -430,13 +430,13 @@ void SetFastMethod(Local<v8::Context> context,
430430 .ToLocalChecked ();
431431 const v8::NewStringType type = v8::NewStringType::kInternalized ;
432432 Local<v8::String> name_string =
433- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
433+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
434434 that->Set (context, name_string, function).Check ();
435435}
436436
437437void SetFastMethodNoSideEffect (Local<v8::Context> context,
438438 Local<v8::Object> that,
439- const char * name,
439+ const std::string_view name,
440440 v8::FunctionCallback slow_callback,
441441 const v8::CFunction* c_function) {
442442 Isolate* isolate = context->GetIsolate ();
@@ -451,13 +451,13 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context,
451451 .ToLocalChecked ();
452452 const v8::NewStringType type = v8::NewStringType::kInternalized ;
453453 Local<v8::String> name_string =
454- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
454+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
455455 that->Set (context, name_string, function).Check ();
456456}
457457
458458void SetFastMethodNoSideEffect (Isolate* isolate,
459459 Local<Template> that,
460- const char * name,
460+ const std::string_view name,
461461 v8::FunctionCallback slow_callback,
462462 const v8::CFunction* c_function) {
463463 Local<v8::FunctionTemplate> t =
@@ -470,13 +470,13 @@ void SetFastMethodNoSideEffect(Isolate* isolate,
470470 // kInternalized strings are created in the old space.
471471 const v8::NewStringType type = v8::NewStringType::kInternalized ;
472472 Local<v8::String> name_string =
473- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
473+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
474474 that->Set (name_string, t);
475475}
476476
477477void SetMethodNoSideEffect (Local<v8::Context> context,
478478 Local<v8::Object> that,
479- const char * name,
479+ const std::string_view name,
480480 v8::FunctionCallback callback) {
481481 Isolate* isolate = context->GetIsolate ();
482482 Local<v8::Function> function =
@@ -490,14 +490,14 @@ void SetMethodNoSideEffect(Local<v8::Context> context,
490490 // kInternalized strings are created in the old space.
491491 const v8::NewStringType type = v8::NewStringType::kInternalized ;
492492 Local<v8::String> name_string =
493- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
493+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
494494 that->Set (context, name_string, function).Check ();
495495 function->SetName (name_string); // NODE_SET_METHOD() compatibility.
496496}
497497
498498void SetMethodNoSideEffect (Isolate* isolate,
499499 Local<v8::Template> that,
500- const char * name,
500+ const std::string_view name,
501501 v8::FunctionCallback callback) {
502502 Local<v8::FunctionTemplate> t =
503503 NewFunctionTemplate (isolate,
@@ -508,13 +508,13 @@ void SetMethodNoSideEffect(Isolate* isolate,
508508 // kInternalized strings are created in the old space.
509509 const v8::NewStringType type = v8::NewStringType::kInternalized ;
510510 Local<v8::String> name_string =
511- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
511+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
512512 that->Set (name_string, t);
513513}
514514
515515void SetProtoMethod (v8::Isolate* isolate,
516516 Local<v8::FunctionTemplate> that,
517- const char * name,
517+ const std::string_view name,
518518 v8::FunctionCallback callback) {
519519 Local<v8::Signature> signature = v8::Signature::New (isolate, that);
520520 Local<v8::FunctionTemplate> t =
@@ -526,14 +526,14 @@ void SetProtoMethod(v8::Isolate* isolate,
526526 // kInternalized strings are created in the old space.
527527 const v8::NewStringType type = v8::NewStringType::kInternalized ;
528528 Local<v8::String> name_string =
529- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
529+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
530530 that->PrototypeTemplate ()->Set (name_string, t);
531531 t->SetClassName (name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
532532}
533533
534534void SetProtoMethodNoSideEffect (v8::Isolate* isolate,
535535 Local<v8::FunctionTemplate> that,
536- const char * name,
536+ const std::string_view name,
537537 v8::FunctionCallback callback) {
538538 Local<v8::Signature> signature = v8::Signature::New (isolate, that);
539539 Local<v8::FunctionTemplate> t =
@@ -545,14 +545,14 @@ void SetProtoMethodNoSideEffect(v8::Isolate* isolate,
545545 // kInternalized strings are created in the old space.
546546 const v8::NewStringType type = v8::NewStringType::kInternalized ;
547547 Local<v8::String> name_string =
548- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
548+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
549549 that->PrototypeTemplate ()->Set (name_string, t);
550550 t->SetClassName (name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
551551}
552552
553553void SetInstanceMethod (v8::Isolate* isolate,
554554 Local<v8::FunctionTemplate> that,
555- const char * name,
555+ const std::string_view name,
556556 v8::FunctionCallback callback) {
557557 Local<v8::Signature> signature = v8::Signature::New (isolate, that);
558558 Local<v8::FunctionTemplate> t =
@@ -564,7 +564,7 @@ void SetInstanceMethod(v8::Isolate* isolate,
564564 // kInternalized strings are created in the old space.
565565 const v8::NewStringType type = v8::NewStringType::kInternalized ;
566566 Local<v8::String> name_string =
567- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
567+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
568568 that->InstanceTemplate ()->Set (name_string, t);
569569 t->SetClassName (name_string);
570570}
0 commit comments