Chromium Code Reviews| Index: Source/bindings/templates/blink_in_js_interface.cpp |
| diff --git a/Source/bindings/templates/blink_in_js_interface.cpp b/Source/bindings/templates/blink_in_js_interface.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bbfb147a0e07acfa2c5835efe45feca7f68cb66c |
| --- /dev/null |
| +++ b/Source/bindings/templates/blink_in_js_interface.cpp |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
| + |
| +#include "config.h" |
| +{% filter conditional(conditional_string) %} |
| +#include "{{v8_class}}.h" |
| + |
| +{% for filename in cpp_includes %} |
| +#include "{{filename}}" |
| +{% endfor %} |
| + |
| +namespace WebCore { |
| + |
| +{% for method in methods %} |
| +bool {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) |
| +{ |
| + v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::blinkInJSWorld()); |
|
abarth-chromium
2014/06/20 15:17:42
DOMWrapperWorld::blinkInJSWorld -> DOMWrapperWorld
|
| + if (context.IsEmpty()) |
| + return false; |
| + ScriptState* scriptState = ScriptState::from(context); |
| + ScriptState::Scope scope(scriptState); |
| + DOMWindow* window = scriptState->domWindow(); |
| + if (!window) |
| + return false; |
| + v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->Global(), scriptState->isolate()); |
| + |
| + {% for argument in method.arguments %} |
| + v8::Handle<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}}; |
| + {% endfor %} |
| + {% if method.arguments %} |
| + v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; |
| + {% else %} |
| + v8::Handle<v8::Value> *argv = 0; |
| + {% endif %} |
| + // FIXME: Support exceptions thrown from Blink-in-JS. |
| + v8::TryCatch block; |
| + {% if method.v8_value_to_cpp_value != '' %} |
| + v8::Handle<v8::Value> v8Value = BlinkInJSController::run(scriptState->isolate(), "{{cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | length}}, argv); |
|
abarth-chromium
2014/06/20 15:17:42
BlinkInJSController -> PrivateScriptController ?
|
| + if (block.HasCaught()) |
| + return false; |
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.name}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()); |
| + {{method.cpp_type}} cppValue = {{method.v8_value_to_cpp_value}}; |
| + if (block.HasCaught()) |
| + return false; |
| + *output = cppValue; |
| + {% else %} |
| + BlinkInJSController::run(scriptState->isolate(), "{{cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | length}}, argv); |
| + if (block.HasCaught()) |
| + return false; |
| + {% endif %} |
| + return true; |
| +} |
| + |
| +{% endfor %} |
| +} // namespace WebCore |
| +{% endfilter %} |