Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} | 1 {% from 'utilities.cpp' 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 "{{v8_class}}.h" | 6 #include "{{v8_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 11 matching lines...) Expand all Loading... | |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool {{v8_class}}::call({{argument_declarations | join(', ')}}) | 25 bool {{v8_class}}::call({{argument_declarations | join(', ')}}) |
| 26 { | 26 { |
| 27 if (!scriptState->contextIsValid()) | 27 if (!scriptState->contextIsValid()) |
| 28 return false; | 28 return false; |
| 29 | 29 |
| 30 if (m_callback.isEmpty()) | 30 if (m_callback.isEmpty()) |
| 31 return false; | 31 return false; |
| 32 | |
| 32 ScriptState::Scope scope(scriptState); | 33 ScriptState::Scope scope(scriptState); |
| 33 | 34 |
| 34 {% for argument in arguments %} | 35 {% for argument in arguments %} |
| 35 v8::Local<v8::Value> {{argument.argument_name}} = {{argument.cpp_value_to_v8 _value}}; | 36 v8::Local<v8::Value> {{argument.argument_name}} = {{argument.cpp_value_to_v8 _value}}; |
| 36 {% endfor %} | 37 {% endfor %} |
| 37 {% if arguments %} | 38 {% if arguments %} |
| 38 v8::Local<v8::Value> argv[] = { {{arguments | join(', ', 'argument_name')}} }; | 39 v8::Local<v8::Value> argv[] = { {{arguments | join(', ', 'argument_name')}} }; |
| 39 {% else %} | 40 {% else %} |
| 40 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 41 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
| 41 v8::Local<v8::Value> *argv = nullptr; | 42 v8::Local<v8::Value> *argv = nullptr; |
| 42 {% endif %} | 43 {% endif %} |
| 43 | 44 |
| 44 v8::Local<v8::Value> v8ReturnValue; | 45 v8::Local<v8::Value> v8ReturnValue; |
| 45 v8::TryCatch exceptionCatcher(scriptState->isolate()); | 46 v8::TryCatch exceptionCatcher(scriptState->isolate()); |
| 46 exceptionCatcher.SetVerbose(true); | |
|
bashi
2016/09/23 01:47:10
Removed SetVerbose(true) call because the testharn
haraken
2016/09/23 01:50:34
Hmm, this might be problematic.
SetVerbose(true)
bashi
2016/09/23 01:58:32
What's a solution then? Also, why don't we always
| |
| 47 | |
| 48 if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()) , scriptState->getExecutionContext(), scriptState->context()->Global(), {{argume nts | length}}, argv, scriptState->isolate()).ToLocal(&v8ReturnValue)) | 47 if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()) , scriptState->getExecutionContext(), scriptState->context()->Global(), {{argume nts | length}}, argv, scriptState->isolate()).ToLocal(&v8ReturnValue)) |
| 49 { | 48 { |
| 50 {% if return_value %} | 49 {% if return_value %} |
| 51 {{v8_value_to_local_cpp_value(return_value) | indent(8)}} | 50 {{v8_value_to_local_cpp_value(return_value) | indent(8)}} |
| 52 returnValue = cppValue; | 51 returnValue = cppValue; |
| 53 {% endif %} | 52 {% endif %} |
| 54 return true; | 53 return true; |
| 55 } | 54 } |
| 55 DCHECK(exceptionCatcher.HasCaught()); | |
| 56 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); | |
| 56 return false; | 57 return false; |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace blink | 60 } // namespace blink |
| 60 | 61 |
| 61 {% endfilter %}{# format_blink_cpp_source_code #} | 62 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |