| 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 17 matching lines...) Expand all Loading... |
| 28 visitor->TraceWrappers(m_callback.Cast<v8::Value>()); | 28 visitor->TraceWrappers(m_callback.Cast<v8::Value>()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) { | 31 bool {{cpp_class}}::call({{argument_declarations | join(', ')}}) { |
| 32 if (m_callback.IsEmpty()) | 32 if (m_callback.IsEmpty()) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 if (!m_scriptState->ContextIsValid()) | 35 if (!m_scriptState->ContextIsValid()) |
| 36 return false; | 36 return false; |
| 37 | 37 |
| 38 ExecutionContext* context = m_scriptState->GetExecutionContext(); | 38 ExecutionContext* context = ExecutionContext::From(m_scriptState.Get()); |
| 39 DCHECK(context); | 39 DCHECK(context); |
| 40 if (context->IsContextSuspended() || context->IsContextDestroyed()) | 40 if (context->IsContextSuspended() || context->IsContextDestroyed()) |
| 41 return false; | 41 return false; |
| 42 | 42 |
| 43 // TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK. | 43 // TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK. |
| 44 // crbug.com/653769 | 44 // crbug.com/653769 |
| 45 DummyExceptionStateForTesting exceptionState; | 45 DummyExceptionStateForTesting exceptionState; |
| 46 ScriptState::Scope scope(m_scriptState.Get()); | 46 ScriptState::Scope scope(m_scriptState.Get()); |
| 47 v8::Isolate* isolate = m_scriptState->GetIsolate(); | 47 v8::Isolate* isolate = m_scriptState->GetIsolate(); |
| 48 | 48 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat
e, v8::Local<v8::Value> value, ExceptionState& exceptionState) { | 83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat
e, v8::Local<v8::Value> value, ExceptionState& exceptionState) { |
| 84 {{cpp_class}}* nativeValue = {{cpp_class}}::Create(ScriptState::Current(isolat
e), value); | 84 {{cpp_class}}* nativeValue = {{cpp_class}}::Create(ScriptState::Current(isolat
e), value); |
| 85 if (!nativeValue) | 85 if (!nativeValue) |
| 86 exceptionState.ThrowTypeError("Unable to convert value to {{callback_functio
n_name}}."); | 86 exceptionState.ThrowTypeError("Unable to convert value to {{callback_functio
n_name}}."); |
| 87 return nativeValue; | 87 return nativeValue; |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| 91 | 91 |
| 92 {% endfilter %}{# format_blink_cpp_source_code #} | 92 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |