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

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

Issue 1873323002: Have bindings layer assume and insist that all interface types are GCed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 {% if method.returns_promise and method.has_exception_state %} 5 {% if method.returns_promise and method.has_exception_state %}
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
7 {% else %} 7 {% else %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
9 {% endif %} 9 {% endif %}
10 { 10 {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 {# [CallWith=ScriptState] #} 244 {# [CallWith=ScriptState] #}
245 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 245 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
246 {% endif %} 246 {% endif %}
247 {% if method.is_call_with_execution_context %} 247 {% if method.is_call_with_execution_context %}
248 {# [ConstructorCallWith=ExecutionContext] #} 248 {# [ConstructorCallWith=ExecutionContext] #}
249 {# [CallWith=ExecutionContext] #} 249 {# [CallWith=ExecutionContext] #}
250 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); 250 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
251 {% endif %} 251 {% endif %}
252 {% if method.is_call_with_script_arguments %} 252 {% if method.is_call_with_script_arguments %}
253 {# [CallWith=ScriptArguments] #} 253 {# [CallWith=ScriptArguments] #}
254 RawPtr<ScriptArguments> scriptArguments(ScriptArguments::create(scriptState, inf o, {{method.number_of_arguments}})); 254 ScriptArguments* scriptArguments(ScriptArguments::create(scriptState, info, {{me thod.number_of_arguments}}));
255 {% endif %} 255 {% endif %}
256 {% if method.is_call_with_document %} 256 {% if method.is_call_with_document %}
257 {# [ConstructorCallWith=Document] #} 257 {# [ConstructorCallWith=Document] #}
258 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); 258 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
259 {% endif %} 259 {% endif %}
260 {# Call #} 260 {# Call #}
261 {% if method.idl_type == 'void' %} 261 {% if method.idl_type == 'void' %}
262 {{cpp_value}}; 262 {{cpp_value}};
263 {% elif method.is_implemented_in_private_script %} 263 {% elif method.is_implemented_in_private_script %}
264 {{method.cpp_type}} result{{method.cpp_type_initializer}}; 264 {{method.cpp_type}} result{{method.cpp_type_initializer}};
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 {##############################################################################} 468 {##############################################################################}
469 {% macro generate_post_message_impl() %} 469 {% macro generate_post_message_impl() %}
470 void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance, const v 8::FunctionCallbackInfo<v8::Value>& info) 470 void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance, const v 8::FunctionCallbackInfo<v8::Value>& info)
471 { 471 {
472 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", interfaceName, info.Holder(), info.GetIsolate()); 472 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", interfaceName, info.Holder(), info.GetIsolate());
473 if (UNLIKELY(info.Length() < 1)) { 473 if (UNLIKELY(info.Length() < 1)) {
474 setMinimumArityTypeError(exceptionState, 1, info.Length()); 474 setMinimumArityTypeError(exceptionState, 1, info.Length());
475 exceptionState.throwIfNeeded(); 475 exceptionState.throwIfNeeded();
476 return; 476 return;
477 } 477 }
478 RawPtr<MessagePortArray> ports = new MessagePortArray; 478 MessagePortArray* ports = new MessagePortArray;
479 ArrayBufferArray arrayBuffers; 479 ArrayBufferArray arrayBuffers;
480 ImageBitmapArray imageBitmaps; 480 ImageBitmapArray imageBitmaps;
481 if (info.Length() > 1) { 481 if (info.Length() > 1) {
482 const int transferablesArgIndex = 1; 482 const int transferablesArgIndex = 1;
483 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, *ports, arrayBuffers, imageBitma ps, exceptionState)) { 483 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, *ports, arrayBuffers, imageBitma ps, exceptionState)) {
484 exceptionState.throwIfNeeded(); 484 exceptionState.throwIfNeeded();
485 return; 485 return;
486 } 486 }
487 } 487 }
488 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan ce().create(info.GetIsolate(), info[0], ports.get(), &arrayBuffers, &imageBitmap s, exceptionState); 488 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan ce().create(info.GetIsolate(), info[0], ports, &arrayBuffers, &imageBitmaps, exc eptionState);
489 if (exceptionState.throwIfNeeded()) 489 if (exceptionState.throwIfNeeded())
490 return; 490 return;
491 // FIXME: Only pass context/exceptionState if instance really requires it. 491 // FIXME: Only pass context/exceptionState if instance really requires it.
492 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); 492 ExecutionContext* context = currentExecutionContext(info.GetIsolate());
493 instance->postMessage(context, message.release(), ports.get(), exceptionStat e); 493 instance->postMessage(context, message.release(), ports, exceptionState);
494 exceptionState.throwIfNeeded(); 494 exceptionState.throwIfNeeded();
495 } 495 }
496 {% endmacro %} 496 {% endmacro %}
497 497
498 {##############################################################################} 498 {##############################################################################}
499 {% macro method_callback(method, world_suffix) %} 499 {% macro method_callback(method, world_suffix) %}
500 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) 500 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info)
501 { 501 {
502 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 502 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
503 {% if method.measure_as %} 503 {% if method.measure_as %}
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 698 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
699 if method.overloads else 699 if method.overloads else
700 method.runtime_enabled_function) %} 700 method.runtime_enabled_function) %}
701 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 701 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
702 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, signature, {{method.name}}MethodConfiguration); 702 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, signature, {{method.name}}MethodConfiguration);
703 {% endfilter %}{# runtime_enabled() #} 703 {% endfilter %}{# runtime_enabled() #}
704 {% endfilter %}{# exposed() #} 704 {% endfilter %}{# exposed() #}
705 {% endfor %} 705 {% endfor %}
706 {% endif %} 706 {% endif %}
707 {%- endmacro %} 707 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698