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: Source/bindings/templates/methods.cpp

Issue 353623003: Remove obsolete document wrapper creation in named constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-document-cleanup
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestInterfaceEventTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (!info.IsConstructCall()) { 533 if (!info.IsConstructCall()) {
534 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("{{co nstructor.name}}"), isolate); 534 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("{{co nstructor.name}}"), isolate);
535 return; 535 return;
536 } 536 }
537 537
538 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject ) { 538 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject ) {
539 v8SetReturnValue(info, info.Holder()); 539 v8SetReturnValue(info, info.Holder());
540 return; 540 return;
541 } 541 }
542 542
543 Document* documentPtr = currentDOMWindow(isolate)->document(); 543 Document& document = *toDocument(currentExecutionContext(isolate));
544 ASSERT(documentPtr);
545 Document& document = *documentPtr;
546
547 // Make sure the document is added to the DOM Node map. Otherwise, the {{cpp _class}} instance
548 // may end up being the only node in the map and get garbage-collected prema turely.
549 toV8(documentPtr, info.Holder(), isolate);
550 544
551 {% if constructor.has_exception_state %} 545 {% if constructor.has_exception_state %}
552 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf ace_name}}", info.Holder(), isolate); 546 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf ace_name}}", info.Holder(), isolate);
553 {% endif %} 547 {% endif %}
554 {% if constructor.number_of_required_arguments %} 548 {% if constructor.number_of_required_arguments %}
555 if (UNLIKELY(info.Length() < {{constructor.number_of_required_arguments}})) { 549 if (UNLIKELY(info.Length() < {{constructor.number_of_required_arguments}})) {
556 {{throw_minimum_arity_type_error(constructor, constructor.number_of_requ ired_arguments)}}; 550 {{throw_minimum_arity_type_error(constructor, constructor.number_of_requ ired_arguments)}};
557 return; 551 return;
558 } 552 }
559 {% endif %} 553 {% endif %}
560 {% if constructor.arguments %} 554 {% if constructor.arguments %}
561 {{generate_arguments(constructor) | indent}} 555 {{generate_arguments(constructor) | indent}}
562 {% endif %} 556 {% endif %}
563 {{constructor.cpp_type}} impl = {{constructor.cpp_value}}; 557 {{constructor.cpp_type}} impl = {{constructor.cpp_value}};
564 {% if is_constructor_raises_exception %} 558 {% if is_constructor_raises_exception %}
565 if (exceptionState.throwIfNeeded()) 559 if (exceptionState.throwIfNeeded())
566 return; 560 return;
567 {% endif %} 561 {% endif %}
568 562
569 {{generate_constructor_wrapper(constructor) | indent}} 563 {{generate_constructor_wrapper(constructor) | indent}}
570 } 564 }
571 {% endmacro %} 565 {% endmacro %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestInterfaceEventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698