| OLD | NEW |
| 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 {{cpp_class}}::{{cpp_class}}(ScriptState* scriptState, v8::Local<v8::Function> c
allback) | 14 {{cpp_class}}::{{cpp_class}}(ScriptState* scriptState, v8::Local<v8::Function> c
allback) |
| 15 : m_scriptState(scriptState), | 15 : m_scriptState(scriptState), |
| 16 m_callback(scriptState->isolate(), callback) { | 16 m_callback(scriptState->isolate(), this, callback) { |
| 17 DCHECK(!m_callback.isEmpty()); | 17 DCHECK(!m_callback.isEmpty()); |
| 18 m_callback.setPhantom(); | 18 m_callback.setPhantom(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 DEFINE_TRACE({{cpp_class}}) {} | 21 DEFINE_TRACE({{cpp_class}}) {} |
| 22 | 22 |
| 23 DEFINE_TRACE_WRAPPERS({{cpp_class}}) { | 23 DEFINE_TRACE_WRAPPERS({{cpp_class}}) { |
| 24 visitor->traceWrappers(&m_callback.cast<v8::Object>()); | 24 visitor->traceWrappers(m_callback.cast<v8::Value>()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) { | 27 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) { |
| 28 if (!m_scriptState->contextIsValid()) | 28 if (!m_scriptState->contextIsValid()) |
| 29 return false; | 29 return false; |
| 30 | 30 |
| 31 ExecutionContext* context = m_scriptState->getExecutionContext(); | 31 ExecutionContext* context = m_scriptState->getExecutionContext(); |
| 32 DCHECK(context); | 32 DCHECK(context); |
| 33 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreSto
pped()) | 33 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreSto
pped()) |
| 34 return false; | 34 return false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 returnValue = cppValue; | 64 returnValue = cppValue; |
| 65 {% endif %} | 65 {% endif %} |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace blink | 71 } // namespace blink |
| 72 | 72 |
| 73 {% endfilter %}{# format_blink_cpp_source_code #} | 73 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |