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

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

Issue 2617653002: bindings: Don't throw a TypeError when 'null' is passed to nullable callback function (Closed)
Patch Set: Created 3 years, 11 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 v8_value_to_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
2 {% filter format_blink_cpp_source_code %} 2 {% filter format_blink_cpp_source_code %}
3 3
4 {% include 'copyright_block.txt' %} 4 {% include 'copyright_block.txt' %}
5 5
6 #include "{{cpp_class}}.h" 6 #include "{{cpp_class}}.h"
7 7
8 {% for filename in cpp_includes %} 8 {% for filename in cpp_includes %}
9 #include "{{filename}}" 9 #include "{{filename}}"
10 {% endfor %} 10 {% endfor %}
11 11
12 namespace blink { 12 namespace blink {
13 13
14 // static
15 {{cpp_class}}* {{cpp_class}}::create(ScriptState* scriptState, v8::Local<v8::Val ue> callback){
16 if (isUndefinedOrNull(callback))
17 return nullptr;
18 return new {{cpp_class}}(scriptState, v8::Local<v8::Function>::Cast(callback)) ;
19 }
20
14 {{cpp_class}}::{{cpp_class}}(ScriptState* scriptState, v8::Local<v8::Function> c allback) 21 {{cpp_class}}::{{cpp_class}}(ScriptState* scriptState, v8::Local<v8::Function> c allback)
15 : m_scriptState(scriptState), 22 : m_scriptState(scriptState),
16 m_callback(scriptState->isolate(), this, callback) { 23 m_callback(scriptState->isolate(), this, callback) {
17 DCHECK(!m_callback.isEmpty()); 24 DCHECK(!m_callback.isEmpty());
18 } 25 }
19 26
20 DEFINE_TRACE({{cpp_class}}) {} 27 DEFINE_TRACE({{cpp_class}}) {}
21 28
22 DEFINE_TRACE_WRAPPERS({{cpp_class}}) { 29 DEFINE_TRACE_WRAPPERS({{cpp_class}}) {
23 visitor->traceWrappers(m_callback.cast<v8::Value>()); 30 visitor->traceWrappers(m_callback.cast<v8::Value>());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 returnValue = cppValue; 70 returnValue = cppValue;
64 {% endif %} 71 {% endif %}
65 return true; 72 return true;
66 } 73 }
67 return false; 74 return false;
68 } 75 }
69 76
70 } // namespace blink 77 } // namespace blink
71 78
72 {% endfilter %}{# format_blink_cpp_source_code #} 79 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698