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}}(v8::Isolate* isolate, v8::Local<v8::Function> callb ack) | 14 {{cpp_class}}::{{cpp_class}}(v8::Isolate* isolate, v8::Local<v8::Function> callb ack) |
15 : m_callback(isolate, callback) | 15 : m_callback(isolate, callback) |
16 { | 16 { |
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 } | 23 } |
24 | 24 |
25 DEFINE_TRACE_WRAPPERS({{cpp_class}}) | |
26 { | |
27 visitor->traceWrappers(&reinterpret_cast<ScopedPersistent<v8::Object>&>(cons t_cast<ScopedPersistent<v8::Function>&>(m_callback))); | |
Marcel Hlopko
2016/10/19 15:08:17
Kentaro, just to be sure, should really each blink
Michael Lippautz
2016/10/19 15:13:41
This infra merely adds the capability of blink cal
haraken
2016/10/19 15:31:43
In almost all cases, the spec requires to add a st
haraken
2016/10/19 15:31:43
Can we add an overloaded function to traceWrappers
Michael Lippautz
2016/10/19 15:44:34
traceWrappers is overloaded with the two basic v8
Michael Lippautz
2016/10/19 15:44:35
Acknowledged.
| |
28 } | |
29 | |
25 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) | 30 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) |
26 { | 31 { |
27 if (!scriptState->contextIsValid()) | 32 if (!scriptState->contextIsValid()) |
28 return false; | 33 return false; |
29 | 34 |
30 ExecutionContext* context = scriptState->getExecutionContext(); | 35 ExecutionContext* context = scriptState->getExecutionContext(); |
31 DCHECK(context); | 36 DCHECK(context); |
32 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS topped()) | 37 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS topped()) |
33 return false; | 38 return false; |
34 | 39 |
(...skipping 29 matching lines...) Expand all Loading... | |
64 returnValue = cppValue; | 69 returnValue = cppValue; |
65 {% endif %} | 70 {% endif %} |
66 return true; | 71 return true; |
67 } | 72 } |
68 return false; | 73 return false; |
69 } | 74 } |
70 | 75 |
71 } // namespace blink | 76 } // namespace blink |
72 | 77 |
73 {% endfilter %}{# format_blink_cpp_source_code #} | 78 {% endfilter %}{# format_blink_cpp_source_code #} |
OLD | NEW |