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

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

Issue 2748353003: [Bindings] Remove redundant ToObject invocation in dictionary toImpl. (Closed)
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %} 3 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %}
4 {% include 'copyright_block.txt' %} 4 {% include 'copyright_block.txt' %}
5 #include "{{v8_original_class}}.h" 5 #include "{{v8_original_class}}.h"
6 6
7 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 7 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
8 #include "{{filename}}" 8 #include "{{filename}}"
9 {% endfor %} 9 {% endfor %}
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 {% if parent_v8_class %} 31 {% if parent_v8_class %}
32 {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState); 32 {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState);
33 if (exceptionState.hadException()) 33 if (exceptionState.hadException())
34 return; 34 return;
35 35
36 {% endif %} 36 {% endif %}
37 {# Declare local variables only when the dictionary has members to avoid unuse d variable warnings. #} 37 {# Declare local variables only when the dictionary has members to avoid unuse d variable warnings. #}
38 {% if members %} 38 {% if members %}
39 v8::TryCatch block(isolate); 39 v8::TryCatch block(isolate);
40 v8::Local<v8::Object> v8Object; 40 v8::Local<v8::Object> v8Object = v8Value.As<v8::Object>();
Yuki 2017/03/16 07:10:43 nit: Could you move this cast up to just after lin
41 if (!v8Call(v8Value->ToObject(isolate->GetCurrentContext()), v8Object, block)) {
42 exceptionState.rethrowV8Exception(block.Exception());
43 return;
44 }
45 {% endif %} 41 {% endif %}
46 {% for member in members %} 42 {% for member in members %}
47 {% filter runtime_enabled(member.runtime_enabled_feature_name) %} 43 {% filter runtime_enabled(member.runtime_enabled_feature_name) %}
48 v8::Local<v8::Value> {{member.name}}Value; 44 v8::Local<v8::Value> {{member.name}}Value;
49 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "{{me mber.name}}")).ToLocal(&{{member.name}}Value)) { 45 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "{{me mber.name}}")).ToLocal(&{{member.name}}Value)) {
50 exceptionState.rethrowV8Exception(block.Exception()); 46 exceptionState.rethrowV8Exception(block.Exception());
51 return; 47 return;
52 } 48 }
53 if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) { 49 if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) {
54 {% if member.is_required %} 50 {% if member.is_required %}
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 125
130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) { 126 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) {
131 {{cpp_class}} impl; 127 {{cpp_class}} impl;
132 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); 128 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
133 return impl; 129 return impl;
134 } 130 }
135 131
136 } // namespace blink 132 } // namespace blink
137 133
138 {% endfilter %}{# format_blink_cpp_source_code #} 134 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698