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

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

Issue 2278433002: Remove redundant IsEmpty() checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %}
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 ScriptForbiddenScope::AllowUserAgentScript script; 578 ScriptForbiddenScope::AllowUserAgentScript script;
579 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri vateScriptIsolatedWorld()); 579 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri vateScriptIsolatedWorld());
580 if (!scriptState) 580 if (!scriptState)
581 return false; 581 return false;
582 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 582 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
583 if (!scriptStateInUserScript) 583 if (!scriptStateInUserScript)
584 return false; 584 return false;
585 585
586 ScriptState::Scope scope(scriptState); 586 ScriptState::Scope scope(scriptState);
587 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 587 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
588 if (holder.IsEmpty())
589 return false;
590
591 {% for argument in method.arguments %} 588 {% for argument in method.arguments %}
592 v8::Local<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_val ue_to_v8_value}}; 589 v8::Local<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_val ue_to_v8_value}};
593 {% endfor %} 590 {% endfor %}
594 {% if method.arguments %} 591 {% if method.arguments %}
595 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; 592 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
596 {% else %} 593 {% else %}
597 {# Empty array initializers are illegal, and don\t compile in MSVC. #} 594 {# Empty array initializers are illegal, and don\t compile in MSVC. #}
598 v8::Local<v8::Value> *argv = 0; 595 v8::Local<v8::Value> *argv = 0;
599 {% endif %} 596 {% endif %}
600 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); 597 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if method.overloads else 694 if method.overloads else
698 method.runtime_enabled_function) %} 695 method.runtime_enabled_function) %}
699 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 696 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
700 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 697 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
701 {% endfilter %}{# runtime_enabled() #} 698 {% endfilter %}{# runtime_enabled() #}
702 {% endfilter %}{# exposed() #} 699 {% endfilter %}{# exposed() #}
703 {% endfilter %}{# secure_context() #} 700 {% endfilter %}{# secure_context() #}
704 {% endfor %} 701 {% endfor %}
705 {% endif %} 702 {% endif %}
706 {%- endmacro %} 703 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698