OLD | NEW |
1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} |
2 | 2 |
3 | 3 |
4 {##############################################################################} | 4 {##############################################################################} |
5 {% macro generate_method(method, world_suffix) %} | 5 {% macro generate_method(method, world_suffix) %} |
6 {% filter conditional(method.conditional_string) %} | 6 {% filter conditional(method.conditional_string) %} |
7 {% if method.returns_promise and method.has_exception_state %} | 7 {% if method.returns_promise and method.has_exception_state %} |
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
9 {% else %} | 9 {% else %} |
10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance, const v
8::FunctionCallbackInfo<v8::Value>& info) | 448 void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance, const v
8::FunctionCallbackInfo<v8::Value>& info) |
449 { | 449 { |
450 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage
", interfaceName, info.Holder(), info.GetIsolate()); | 450 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage
", interfaceName, info.Holder(), info.GetIsolate()); |
451 if (UNLIKELY(info.Length() < 1)) { | 451 if (UNLIKELY(info.Length() < 1)) { |
452 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 452 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
453 exceptionState.throwIfNeeded(); | 453 exceptionState.throwIfNeeded(); |
454 return; | 454 return; |
455 } | 455 } |
456 OwnPtrWillBeRawPtr<MessagePortArray> ports = adoptPtrWillBeNoop(new MessageP
ortArray); | 456 OwnPtrWillBeRawPtr<MessagePortArray> ports = adoptPtrWillBeNoop(new MessageP
ortArray); |
457 ArrayBufferArray arrayBuffers; | 457 ArrayBufferArray arrayBuffers; |
| 458 SharedArrayBufferArray sharedArrayBuffers; |
458 if (info.Length() > 1) { | 459 if (info.Length() > 1) { |
459 const int transferablesArgIndex = 1; | 460 const int transferablesArgIndex = 1; |
460 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, *ports, arrayBuffers, exceptionS
tate)) { | 461 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, *ports, arrayBuffers, sharedArra
yBuffers, exceptionState)) { |
461 exceptionState.throwIfNeeded(); | 462 exceptionState.throwIfNeeded(); |
462 return; | 463 return; |
463 } | 464 } |
464 } | 465 } |
465 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], ports.get(), &arrayBuffers, exceptionSta
te); | 466 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], ports.get(), &arrayBuffers, &sharedArray
Buffers, exceptionState); |
466 if (exceptionState.throwIfNeeded()) | 467 if (exceptionState.throwIfNeeded()) |
467 return; | 468 return; |
468 // FIXME: Only pass context/exceptionState if instance really requires it. | 469 // FIXME: Only pass context/exceptionState if instance really requires it. |
469 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); | 470 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
470 instance->postMessage(context, message.release(), ports.get(), exceptionStat
e); | 471 instance->postMessage(context, message.release(), ports.get(), exceptionStat
e); |
471 exceptionState.throwIfNeeded(); | 472 exceptionState.throwIfNeeded(); |
472 } | 473 } |
473 {% endmacro %} | 474 {% endmacro %} |
474 | 475 |
475 {##############################################################################} | 476 {##############################################################################} |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 if method.overloads else | 692 if method.overloads else |
692 method.runtime_enabled_function) %} | 693 method.runtime_enabled_function) %} |
693 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(iso
late, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undef
ined(), defaultSignature, {{method.number_of_required_arguments}}); | 694 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(iso
late, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undef
ined(), defaultSignature, {{method.number_of_required_arguments}}); |
694 v8::Local<v8::Function> function = ->GetFunction(isolate->GetCurrentContext())).
ToLocalChecked(); | 695 v8::Local<v8::Function> function = ->GetFunction(isolate->GetCurrentContext())).
ToLocalChecked(); |
695 v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(
isolate, "{{method.name}}"), function)); | 696 v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(
isolate, "{{method.name}}"), function)); |
696 {% endfilter %}{# runtime_enabled() #} | 697 {% endfilter %}{# runtime_enabled() #} |
697 {% endfilter %}{# exposed() #} | 698 {% endfilter %}{# exposed() #} |
698 {% endfor %} | 699 {% endfor %} |
699 {% endif %} | 700 {% endif %} |
700 {%- endmacro %} | 701 {%- endmacro %} |
OLD | NEW |