| 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 %} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK. | 38 // TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK. |
| 39 // crbug.com/653769 | 39 // crbug.com/653769 |
| 40 DummyExceptionStateForTesting exceptionState; | 40 DummyExceptionStateForTesting exceptionState; |
| 41 ScriptState::Scope scope(m_scriptState.get()); | 41 ScriptState::Scope scope(m_scriptState.get()); |
| 42 | 42 |
| 43 {% for argument in arguments %} | 43 {% for argument in arguments %} |
| 44 v8::Local<v8::Value> {{argument.argument_name}} = {{argument.cpp_value_to_v8_v
alue}}; | 44 v8::Local<v8::Value> {{argument.argument_name}} = {{argument.cpp_value_to_v8_v
alue}}; |
| 45 {% endfor %} | 45 {% endfor %} |
| 46 | 46 |
| 47 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, m_scriptState->context(
)->Global(), m_scriptState->isolate()); | 47 v8::Local<v8::Value> thisValue = ToV8(scriptWrappable, m_scriptState->context(
)->Global(), m_scriptState->isolate()); |
| 48 | 48 |
| 49 {% if arguments %} | 49 {% if arguments %} |
| 50 v8::Local<v8::Value> argv[] = { {{arguments | join(', ', 'argument_name')}} }; | 50 v8::Local<v8::Value> argv[] = { {{arguments | join(', ', 'argument_name')}} }; |
| 51 {% else %} | 51 {% else %} |
| 52 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 52 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
| 53 v8::Local<v8::Value> *argv = nullptr; | 53 v8::Local<v8::Value> *argv = nullptr; |
| 54 {% endif %} | 54 {% endif %} |
| 55 | 55 |
| 56 v8::Local<v8::Value> v8ReturnValue; | 56 v8::Local<v8::Value> v8ReturnValue; |
| 57 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); | 57 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); |
| 58 exceptionCatcher.SetVerbose(true); | 58 exceptionCatcher.SetVerbose(true); |
| 59 | 59 |
| 60 if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate())
, m_scriptState->getExecutionContext(), thisValue, {{arguments | length}}, argv,
m_scriptState->isolate()).ToLocal(&v8ReturnValue)) { | 60 if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate())
, m_scriptState->getExecutionContext(), thisValue, {{arguments | length}}, argv,
m_scriptState->isolate()).ToLocal(&v8ReturnValue)) { |
| 61 {% if return_value %} | 61 {% if return_value %} |
| 62 {{v8_value_to_local_cpp_value(return_value) | indent(8)}} | 62 {{v8_value_to_local_cpp_value(return_value) | indent(8)}} |
| 63 returnValue = cppValue; | 63 returnValue = cppValue; |
| 64 {% endif %} | 64 {% endif %} |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| 71 | 71 |
| 72 {% endfilter %}{# format_blink_cpp_source_code #} | 72 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |