Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2768113002: WIP: Create a LongStringCollection that transfers long strings with fewer copies.
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SerializedScriptValue::SerializeOptions options; 436 SerializedScriptValue::SerializeOptions options;
437 options.transferables = &transferables; 437 options.transferables = &transferables;
438 options.longStringPolicy = LongStringPolicy(LongStringPolicy::kSameProcess, 512);
438 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], optio ns, exceptionState); 439 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], optio ns, exceptionState);
439 if (exceptionState.hadException()) 440 if (exceptionState.hadException())
440 return; 441 return;
441 } else { 442 } else {
442 // This instance doesn't support sending array buffers and image bitmaps 443 // This instance doesn't support sending array buffers and image bitmaps
443 // by move semantics. Emulate it by copy-and-neuter semantics that sends 444 // by move semantics. Emulate it by copy-and-neuter semantics that sends
444 // array buffers and image bitmaps via structured clone and then neuters 445 // array buffers and image bitmaps via structured clone and then neuters
445 // the original objects 446 // the original objects
446 447
447 // Clear references to array buffers and image bitmaps from transferables 448 // Clear references to array buffers and image bitmaps from transferables
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 {{method_configuration(method) | indent(2)}} 645 {{method_configuration(method) | indent(2)}}
645 }; 646 };
646 for (const auto& methodConfig : {{method.name}}MethodConfiguration) 647 for (const auto& methodConfig : {{method.name}}MethodConfiguration)
647 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, methodConfig); 648 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, methodConfig);
648 {% endfilter %}{# runtime_enabled() #} 649 {% endfilter %}{# runtime_enabled() #}
649 {% endfilter %}{# exposed() #} 650 {% endfilter %}{# exposed() #}
650 {% endfilter %}{# secure_context() #} 651 {% endfilter %}{# secure_context() #}
651 {% endfor %} 652 {% endfor %}
652 {% endif %} 653 {% endif %}
653 {%- endmacro %} 654 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698