@@ -358,7 +358,7 @@ Local<v8::FunctionTemplate> NewFunctionTemplate(
358
358
359
359
void SetMethod (Local<v8::Context> context,
360
360
Local<v8::Object> that,
361
- const char * name,
361
+ const std::string_view name,
362
362
v8::FunctionCallback callback) {
363
363
Isolate* isolate = context->GetIsolate ();
364
364
Local<v8::Function> function =
@@ -372,14 +372,14 @@ void SetMethod(Local<v8::Context> context,
372
372
// kInternalized strings are created in the old space.
373
373
const v8::NewStringType type = v8::NewStringType::kInternalized ;
374
374
Local<v8::String> name_string =
375
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
375
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
376
376
that->Set (context, name_string, function).Check ();
377
377
function->SetName (name_string); // NODE_SET_METHOD() compatibility.
378
378
}
379
379
380
380
void SetMethod (v8::Isolate* isolate,
381
381
v8::Local<v8::Template> that,
382
- const char * name,
382
+ const std::string_view name,
383
383
v8::FunctionCallback callback) {
384
384
Local<v8::FunctionTemplate> t =
385
385
NewFunctionTemplate (isolate,
@@ -390,13 +390,13 @@ void SetMethod(v8::Isolate* isolate,
390
390
// kInternalized strings are created in the old space.
391
391
const v8::NewStringType type = v8::NewStringType::kInternalized ;
392
392
Local<v8::String> name_string =
393
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
393
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
394
394
that->Set (name_string, t);
395
395
}
396
396
397
397
void SetFastMethod (Isolate* isolate,
398
398
Local<Template> that,
399
- const char * name,
399
+ const std::string_view name,
400
400
v8::FunctionCallback slow_callback,
401
401
const v8::CFunction* c_function) {
402
402
Local<v8::FunctionTemplate> t =
@@ -409,13 +409,13 @@ void SetFastMethod(Isolate* isolate,
409
409
// kInternalized strings are created in the old space.
410
410
const v8::NewStringType type = v8::NewStringType::kInternalized ;
411
411
Local<v8::String> name_string =
412
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
412
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
413
413
that->Set (name_string, t);
414
414
}
415
415
416
416
void SetFastMethod (Local<v8::Context> context,
417
417
Local<v8::Object> that,
418
- const char * name,
418
+ const std::string_view name,
419
419
v8::FunctionCallback slow_callback,
420
420
const v8::CFunction* c_function) {
421
421
Isolate* isolate = context->GetIsolate ();
@@ -430,13 +430,13 @@ void SetFastMethod(Local<v8::Context> context,
430
430
.ToLocalChecked ();
431
431
const v8::NewStringType type = v8::NewStringType::kInternalized ;
432
432
Local<v8::String> name_string =
433
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
433
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
434
434
that->Set (context, name_string, function).Check ();
435
435
}
436
436
437
437
void SetFastMethodNoSideEffect (Local<v8::Context> context,
438
438
Local<v8::Object> that,
439
- const char * name,
439
+ const std::string_view name,
440
440
v8::FunctionCallback slow_callback,
441
441
const v8::CFunction* c_function) {
442
442
Isolate* isolate = context->GetIsolate ();
@@ -451,13 +451,13 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context,
451
451
.ToLocalChecked ();
452
452
const v8::NewStringType type = v8::NewStringType::kInternalized ;
453
453
Local<v8::String> name_string =
454
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
454
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
455
455
that->Set (context, name_string, function).Check ();
456
456
}
457
457
458
458
void SetFastMethodNoSideEffect (Isolate* isolate,
459
459
Local<Template> that,
460
- const char * name,
460
+ const std::string_view name,
461
461
v8::FunctionCallback slow_callback,
462
462
const v8::CFunction* c_function) {
463
463
Local<v8::FunctionTemplate> t =
@@ -470,13 +470,13 @@ void SetFastMethodNoSideEffect(Isolate* isolate,
470
470
// kInternalized strings are created in the old space.
471
471
const v8::NewStringType type = v8::NewStringType::kInternalized ;
472
472
Local<v8::String> name_string =
473
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
473
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
474
474
that->Set (name_string, t);
475
475
}
476
476
477
477
void SetMethodNoSideEffect (Local<v8::Context> context,
478
478
Local<v8::Object> that,
479
- const char * name,
479
+ const std::string_view name,
480
480
v8::FunctionCallback callback) {
481
481
Isolate* isolate = context->GetIsolate ();
482
482
Local<v8::Function> function =
@@ -490,14 +490,14 @@ void SetMethodNoSideEffect(Local<v8::Context> context,
490
490
// kInternalized strings are created in the old space.
491
491
const v8::NewStringType type = v8::NewStringType::kInternalized ;
492
492
Local<v8::String> name_string =
493
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
493
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
494
494
that->Set (context, name_string, function).Check ();
495
495
function->SetName (name_string); // NODE_SET_METHOD() compatibility.
496
496
}
497
497
498
498
void SetMethodNoSideEffect (Isolate* isolate,
499
499
Local<v8::Template> that,
500
- const char * name,
500
+ const std::string_view name,
501
501
v8::FunctionCallback callback) {
502
502
Local<v8::FunctionTemplate> t =
503
503
NewFunctionTemplate (isolate,
@@ -508,13 +508,13 @@ void SetMethodNoSideEffect(Isolate* isolate,
508
508
// kInternalized strings are created in the old space.
509
509
const v8::NewStringType type = v8::NewStringType::kInternalized ;
510
510
Local<v8::String> name_string =
511
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
511
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
512
512
that->Set (name_string, t);
513
513
}
514
514
515
515
void SetProtoMethod (v8::Isolate* isolate,
516
516
Local<v8::FunctionTemplate> that,
517
- const char * name,
517
+ const std::string_view name,
518
518
v8::FunctionCallback callback) {
519
519
Local<v8::Signature> signature = v8::Signature::New (isolate, that);
520
520
Local<v8::FunctionTemplate> t =
@@ -526,14 +526,14 @@ void SetProtoMethod(v8::Isolate* isolate,
526
526
// kInternalized strings are created in the old space.
527
527
const v8::NewStringType type = v8::NewStringType::kInternalized ;
528
528
Local<v8::String> name_string =
529
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
529
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
530
530
that->PrototypeTemplate ()->Set (name_string, t);
531
531
t->SetClassName (name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
532
532
}
533
533
534
534
void SetProtoMethodNoSideEffect (v8::Isolate* isolate,
535
535
Local<v8::FunctionTemplate> that,
536
- const char * name,
536
+ const std::string_view name,
537
537
v8::FunctionCallback callback) {
538
538
Local<v8::Signature> signature = v8::Signature::New (isolate, that);
539
539
Local<v8::FunctionTemplate> t =
@@ -545,14 +545,14 @@ void SetProtoMethodNoSideEffect(v8::Isolate* isolate,
545
545
// kInternalized strings are created in the old space.
546
546
const v8::NewStringType type = v8::NewStringType::kInternalized ;
547
547
Local<v8::String> name_string =
548
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
548
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
549
549
that->PrototypeTemplate ()->Set (name_string, t);
550
550
t->SetClassName (name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
551
551
}
552
552
553
553
void SetInstanceMethod (v8::Isolate* isolate,
554
554
Local<v8::FunctionTemplate> that,
555
- const char * name,
555
+ const std::string_view name,
556
556
v8::FunctionCallback callback) {
557
557
Local<v8::Signature> signature = v8::Signature::New (isolate, that);
558
558
Local<v8::FunctionTemplate> t =
@@ -564,7 +564,7 @@ void SetInstanceMethod(v8::Isolate* isolate,
564
564
// kInternalized strings are created in the old space.
565
565
const v8::NewStringType type = v8::NewStringType::kInternalized ;
566
566
Local<v8::String> name_string =
567
- v8::String::NewFromUtf8 (isolate, name, type).ToLocalChecked ();
567
+ v8::String::NewFromUtf8 (isolate, name. data () , type, name. size () ).ToLocalChecked ();
568
568
that->InstanceTemplate ()->Set (name_string, t);
569
569
t->SetClassName (name_string);
570
570
}
0 commit comments