OLD | NEW |
1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} |
2 | 2 |
3 {##############################################################################} | 3 {##############################################################################} |
4 {% macro generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { | 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { |
6 {% filter format_remove_duplicates([ | 6 {% filter format_remove_duplicates([ |
7 'ExceptionState exceptionState', | 7 'ExceptionState exceptionState', |
8 'ScriptState* scriptState = ']) %} | 8 'ScriptState* scriptState = ']) %} |
9 {% set define_exception_state -%} | 9 {% set define_exception_state -%} |
10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont
ext, "{{interface_name}}", "{{method.name}}"); | 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont
ext, "{{interface_name}}", "{{method.name}}"); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (info.Length() > 1) { | 426 if (info.Length() > 1) { |
427 const int transferablesArgIndex = 1; | 427 const int transferablesArgIndex = 1; |
428 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info[tra
nsferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) { | 428 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info[tra
nsferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) { |
429 return; | 429 return; |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 RefPtr<SerializedScriptValue> message; | 433 RefPtr<SerializedScriptValue> message; |
434 if (instance->canTransferArrayBuffersAndImageBitmaps()) { | 434 if (instance->canTransferArrayBuffersAndImageBitmaps()) { |
435 // This instance supports sending array buffers by move semantics. | 435 // This instance supports sending array buffers by move semantics. |
436 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], &tran
sferables, nullptr, exceptionState); | 436 SerializedScriptValue::SerializeOptions options; |
| 437 options.transferables = &transferables; |
| 438 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], optio
ns, exceptionState); |
437 if (exceptionState.hadException()) | 439 if (exceptionState.hadException()) |
438 return; | 440 return; |
439 } else { | 441 } else { |
440 // This instance doesn't support sending array buffers and image bitmaps | 442 // This instance doesn't support sending array buffers and image bitmaps |
441 // by move semantics. Emulate it by copy-and-neuter semantics that sends | 443 // by move semantics. Emulate it by copy-and-neuter semantics that sends |
442 // array buffers and image bitmaps via structured clone and then neuters | 444 // array buffers and image bitmaps via structured clone and then neuters |
443 // the original objects | 445 // the original objects |
444 | 446 |
445 // Clear references to array buffers and image bitmaps from transferables | 447 // Clear references to array buffers and image bitmaps from transferables |
446 // so that the serializer can consider the array buffers as | 448 // so that the serializer can consider the array buffers as |
447 // non-transferable and serialize them into the message. | 449 // non-transferable and serialize them into the message. |
448 ArrayBufferArray transferableArrayBuffers = transferables.arrayBuffers; | 450 ArrayBufferArray transferableArrayBuffers = transferables.arrayBuffers; |
449 transferables.arrayBuffers.clear(); | 451 transferables.arrayBuffers.clear(); |
450 ImageBitmapArray transferableImageBitmaps = transferables.imageBitmaps; | 452 ImageBitmapArray transferableImageBitmaps = transferables.imageBitmaps; |
451 transferables.imageBitmaps.clear(); | 453 transferables.imageBitmaps.clear(); |
452 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], &tran
sferables, nullptr, exceptionState); | 454 SerializedScriptValue::SerializeOptions options; |
| 455 options.transferables = &transferables; |
| 456 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], optio
ns, exceptionState); |
453 if (exceptionState.hadException()) | 457 if (exceptionState.hadException()) |
454 return; | 458 return; |
455 | 459 |
456 // Neuter the original array buffers on the sender context. | 460 // Neuter the original array buffers on the sender context. |
457 SerializedScriptValue::transferArrayBufferContents(info.GetIsolate(), transf
erableArrayBuffers, exceptionState); | 461 SerializedScriptValue::transferArrayBufferContents(info.GetIsolate(), transf
erableArrayBuffers, exceptionState); |
458 if (exceptionState.hadException()) | 462 if (exceptionState.hadException()) |
459 return; | 463 return; |
460 // Neuter the original image bitmaps on the sender context. | 464 // Neuter the original image bitmaps on the sender context. |
461 SerializedScriptValue::transferImageBitmapContents(info.GetIsolate(), transf
erableImageBitmaps, exceptionState); | 465 SerializedScriptValue::transferImageBitmapContents(info.GetIsolate(), transf
erableImageBitmaps, exceptionState); |
462 if (exceptionState.hadException()) | 466 if (exceptionState.hadException()) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 {{method_configuration(method) | indent(2)}} | 644 {{method_configuration(method) | indent(2)}} |
641 }; | 645 }; |
642 for (const auto& methodConfig : {{method.name}}MethodConfiguration) | 646 for (const auto& methodConfig : {{method.name}}MethodConfiguration) |
643 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); | 647 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); |
644 {% endfilter %}{# runtime_enabled() #} | 648 {% endfilter %}{# runtime_enabled() #} |
645 {% endfilter %}{# exposed() #} | 649 {% endfilter %}{# exposed() #} |
646 {% endfilter %}{# secure_context() #} | 650 {% endfilter %}{# secure_context() #} |
647 {% endfor %} | 651 {% endfor %} |
648 {% endif %} | 652 {% endif %} |
649 {%- endmacro %} | 653 {%- endmacro %} |
OLD | NEW |