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 : m_scriptState(scriptState) { | 13 : m_scriptState(scriptState) { |
14 m_callback.Set(scriptState->GetIsolate(), callback); | 14 m_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(', ')}}) { |
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 = | 27 ExecutionContext* executionContext = |
28 ExecutionContext::From(m_scriptState.Get()); | 28 ExecutionContext::From(m_scriptState.Get()); |
29 if (!executionContext || executionContext->IsContextSuspended() || | 29 DCHECK(!executionContext->IsContextSuspended()); |
30 executionContext->IsContextDestroyed()) | 30 if (!executionContext || executionContext->IsContextDestroyed()) |
31 {{return_default}}; | 31 {{return_default}}; |
32 if (!m_scriptState->ContextIsValid()) | 32 if (!m_scriptState->ContextIsValid()) |
33 {{return_default}}; | 33 {{return_default}}; |
34 | 34 |
35 ScriptState::Scope scope(m_scriptState.Get()); | 35 ScriptState::Scope scope(m_scriptState.Get()); |
36 {% if method.call_with_this_handle %} | 36 {% if method.call_with_this_handle %} |
37 v8::Local<v8::Value> thisHandle = thisValue.V8Value(); | 37 v8::Local<v8::Value> thisHandle = thisValue.V8Value(); |
38 {% endif %} | 38 {% endif %} |
39 | 39 |
40 {% for argument in method.arguments %} | 40 {% for argument in method.arguments %} |
(...skipping 26 matching lines...) Expand all Loading... |
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 |