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

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

Issue 2741793003: Accurate transfer of SerializedScriptValue allocation costs. (Closed)
Patch Set: sanity check diff adjustments 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 if (exceptionState.hadException()) 458 if (exceptionState.hadException())
459 return; 459 return;
460 // Neuter the original image bitmaps on the sender context. 460 // Neuter the original image bitmaps on the sender context.
461 SerializedScriptValue::transferImageBitmapContents(info.GetIsolate(), transf erableImageBitmaps, exceptionState); 461 SerializedScriptValue::transferImageBitmapContents(info.GetIsolate(), transf erableImageBitmaps, exceptionState);
462 if (exceptionState.hadException()) 462 if (exceptionState.hadException())
463 return; 463 return;
464 } 464 }
465 465
466 // FIXME: Only pass scriptState/exceptionState if instance really requires it. 466 // FIXME: Only pass scriptState/exceptionState if instance really requires it.
467 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 467 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
468 message->unregisterMemoryAllocatedWithCurrentScriptContext();
468 instance->postMessage(scriptState, message.get(), transferables.messagePorts, exceptionState); 469 instance->postMessage(scriptState, message.get(), transferables.messagePorts, exceptionState);
469 message->unregisterMemoryAllocatedByCurrentScriptContext();
470 } 470 }
471 {% endmacro %} 471 {% endmacro %}
472 472
473 473
474 {##############################################################################} 474 {##############################################################################}
475 {% macro method_callback(method, world_suffix) %} 475 {% macro method_callback(method, world_suffix) %}
476 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) { 476 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) {
477 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #} 477 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #}
478 {% if method.measure_as %} 478 {% if method.measure_as %}
479 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}}); 479 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}});
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if method.overloads else 627 if method.overloads else
628 method.runtime_enabled_feature_name) %} 628 method.runtime_enabled_feature_name) %}
629 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 629 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
630 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 630 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
631 {% endfilter %}{# runtime_enabled() #} 631 {% endfilter %}{# runtime_enabled() #}
632 {% endfilter %}{# exposed() #} 632 {% endfilter %}{# exposed() #}
633 {% endfilter %}{# secure_context() #} 633 {% endfilter %}{# secure_context() #}
634 {% endfor %} 634 {% endfor %}
635 {% endif %} 635 {% endif %}
636 {%- endmacro %} 636 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698