| 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 { |
| 11 | 11 |
| 12 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script
State) | 12 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script
State) |
| 13 : script_state_(scriptState) { | 13 : script_state_(scriptState) { |
| 14 m_callback.Set(scriptState->GetIsolate(), callback); | 14 callback_.Set(scriptState->GetIsolate(), callback); |
| 15 } | 15 } |
| 16 | 16 |
| 17 {{v8_class}}::~{{v8_class}}() {} | 17 {{v8_class}}::~{{v8_class}}() {} |
| 18 | 18 |
| 19 DEFINE_TRACE({{v8_class}}) { | 19 DEFINE_TRACE({{v8_class}}) { |
| 20 {{cpp_class}}::Trace(visitor); | 20 {{cpp_class}}::Trace(visitor); |
| 21 } | 21 } |
| 22 | 22 |
| 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(', ')}}) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 46 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
| 47 v8::Local<v8::Value> *argv = 0; | 47 v8::Local<v8::Value> *argv = 0; |
| 48 {% endif %} | 48 {% endif %} |
| 49 | 49 |
| 50 v8::Isolate* isolate = script_state_->GetIsolate(); | 50 v8::Isolate* isolate = script_state_->GetIsolate(); |
| 51 {% set this_handle_parameter = 'thisHandle' | 51 {% set this_handle_parameter = 'thisHandle' |
| 52 if method.call_with_this_handle else 'v8::Undefined(isolate)' %} | 52 if method.call_with_this_handle else 'v8::Undefined(isolate)' %} |
| 53 {% if method.idl_type == 'boolean' %} | 53 {% if method.idl_type == 'boolean' %} |
| 54 v8::TryCatch exceptionCatcher(isolate); | 54 v8::TryCatch exceptionCatcher(isolate); |
| 55 exceptionCatcher.SetVerbose(true); | 55 exceptionCatcher.SetVerbose(true); |
| 56 V8ScriptRunner::CallFunction(m_callback.NewLocal(isolate), | 56 V8ScriptRunner::CallFunction(callback_.NewLocal(isolate), |
| 57 executionContext, | 57 executionContext, |
| 58 {{this_handle_parameter}}, | 58 {{this_handle_parameter}}, |
| 59 {{method.arguments | length}}, | 59 {{method.arguments | length}}, |
| 60 argv, | 60 argv, |
| 61 isolate); | 61 isolate); |
| 62 return !exceptionCatcher.HasCaught(); | 62 return !exceptionCatcher.HasCaught(); |
| 63 {% else %}{# void #} | 63 {% else %}{# void #} |
| 64 V8ScriptRunner::CallFunction(m_callback.NewLocal(isolate), | 64 V8ScriptRunner::CallFunction(callback_.NewLocal(isolate), |
| 65 ExecutionContext::From(script_state_.Get()), | 65 ExecutionContext::From(script_state_.Get()), |
| 66 {{this_handle_parameter}}, | 66 {{this_handle_parameter}}, |
| 67 {{method.arguments | length}}, | 67 {{method.arguments | length}}, |
| 68 argv, | 68 argv, |
| 69 isolate); | 69 isolate); |
| 70 {% endif %} | 70 {% endif %} |
| 71 } | 71 } |
| 72 | 72 |
| 73 {% endfor %} | 73 {% endfor %} |
| 74 } // namespace blink | 74 } // namespace blink |
| 75 | 75 |
| 76 {% endfilter %}{# format_blink_cpp_source_code #} | 76 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |