| OLD | NEW |
| 1 {% filter format_blink_cpp_source_code %} | 1 {% filter format_blink_cpp_source_code %} |
| 2 | 2 |
| 3 {% include 'copyright_block.txt' %} | 3 {% include 'copyright_block.txt' %} |
| 4 #include "{{v8_class}}.h" | 4 #include "{{v8_class}}.h" |
| 5 | 5 |
| 6 {% for filename in cpp_includes %} | 6 {% for filename in cpp_includes %} |
| 7 #include "{{filename}}" | 7 #include "{{filename}}" |
| 8 {% endfor %} | 8 {% endfor %} |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 {% for method in methods if not method.is_custom %} | 23 {% for method in methods if not method.is_custom %} |
| 24 {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations
| join(', ')}}) { | 24 {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations
| join(', ')}}) { |
| 25 {% set return_default = 'return true' | 25 {% set return_default = 'return true' |
| 26 if method.idl_type == 'boolean' else 'return' %}{# void #} | 26 if method.idl_type == 'boolean' else 'return' %}{# void #} |
| 27 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); | 27 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 28 if (!executionContext || executionContext->isContextSuspended() || | 28 if (!executionContext || executionContext->isContextSuspended() || |
| 29 executionContext->isContextDestroyed()) | 29 executionContext->isContextDestroyed()) |
| 30 {{return_default}}; | 30 {{return_default}}; |
| 31 if (!m_scriptState->contextIsValid()) | 31 if (!m_scriptState->contextIsValid()) |
| 32 {{return_default}}; | 32 {{return_default}}; |
| 33 |
| 33 ScriptState::Scope scope(m_scriptState.get()); | 34 ScriptState::Scope scope(m_scriptState.get()); |
| 34 {% if method.call_with_this_handle %} | 35 {% if method.call_with_this_handle %} |
| 35 v8::Local<v8::Value> thisHandle = thisValue.v8Value(); | 36 v8::Local<v8::Value> thisHandle = thisValue.v8Value(); |
| 36 {% endif %} | 37 {% endif %} |
| 38 |
| 37 {% for argument in method.arguments %} | 39 {% for argument in method.arguments %} |
| 38 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}}; | 40 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}}; |
| 39 {% endfor %} | 41 {% endfor %} |
| 40 {% if method.arguments %} | 42 {% if method.arguments %} |
| 41 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; | 43 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; |
| 42 {% else %} | 44 {% else %} |
| 43 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 45 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
| 44 v8::Local<v8::Value> *argv = 0; | 46 v8::Local<v8::Value> *argv = 0; |
| 45 {% endif %} | 47 {% endif %} |
| 46 | 48 |
| 47 {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle
else 'v8::Undefined(m_scriptState->isolate()), ' %} | 49 v8::Isolate* isolate = m_scriptState->isolate(); |
| 50 {% set this_handle_parameter = 'thisHandle' |
| 51 if method.call_with_this_handle else 'v8::Undefined(isolate)' %} |
| 48 {% if method.idl_type == 'boolean' %} | 52 {% if method.idl_type == 'boolean' %} |
| 49 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); | 53 v8::TryCatch exceptionCatcher(isolate); |
| 50 exceptionCatcher.SetVerbose(true); | 54 exceptionCatcher.SetVerbose(true); |
| 51 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_
scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments
| length}}, argv, m_scriptState->isolate()); | 55 V8ScriptRunner::callFunction(m_callback.newLocal(isolate), |
| 56 executionContext, |
| 57 {{this_handle_parameter}}, |
| 58 {{method.arguments | length}}, |
| 59 argv, |
| 60 isolate); |
| 52 return !exceptionCatcher.HasCaught(); | 61 return !exceptionCatcher.HasCaught(); |
| 53 {% else %}{# void #} | 62 {% else %}{# void #} |
| 54 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_
scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments
| length}}, argv, m_scriptState->isolate()); | 63 V8ScriptRunner::callFunction(m_callback.newLocal(isolate), |
| 55 {% endif %} | 64 m_scriptState->getExecutionContext(), |
| 65 {{this_handle_parameter}}, |
| 66 {{method.arguments | length}}, |
| 67 argv, |
| 68 isolate); |
| 69 {% endif %} |
| 56 } | 70 } |
| 57 | 71 |
| 58 {% endfor %} | 72 {% endfor %} |
| 59 } // namespace blink | 73 } // namespace blink |
| 60 | 74 |
| 61 {% endfilter %}{# format_blink_cpp_source_code #} | 75 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |