| Index: Source/bindings/templates/private_script_interface.cpp
|
| diff --git a/Source/bindings/templates/private_script_interface.cpp b/Source/bindings/templates/private_script_interface.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..af5b25a0db813f70d0f26166c0c2ce4a324153f3
|
| --- /dev/null
|
| +++ b/Source/bindings/templates/private_script_interface.cpp
|
| @@ -0,0 +1,60 @@
|
| +// 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::privateScriptWorld());
|
| + if (context.IsEmpty())
|
| + return false;
|
| + ScriptState* scriptState = ScriptState::from(context);
|
| + if (!scriptState->executionContext() || !scriptState->domWindow())
|
| + return false;
|
| +
|
| + ScriptState::Scope scope(scriptState);
|
| + v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), 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 %}
|
| + {# Empty array initializers are illegal in MSVC. #}
|
| + 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 = PrivateScriptController::run(scriptState, "{{cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | length}}, argv);
|
| + 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 %}{# void return type #}
|
| + PrivateScriptController::run(scriptState, "{{cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | length}}, argv);
|
| + if (block.HasCaught())
|
| + return false;
|
| + {% endif %}
|
| + return true;
|
| +}
|
| +
|
| +{% endfor %}
|
| +} // namespace WebCore
|
| +{% endfilter %}
|
|
|