Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: Source/bindings/templates/blink_in_js_interface.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6
7 #include "config.h"
8 {% filter conditional(conditional_string) %}
9 #include "{{v8_class}}.h"
10
11 {% for filename in cpp_includes %}
12 #include "{{filename}}"
13 {% endfor %}
14
15 namespace WebCore {
16
17 {% for method in methods %}
18 bool {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}} )
19 {
20 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::blinkI nJSWorld());
abarth-chromium 2014/06/20 15:17:42 DOMWrapperWorld::blinkInJSWorld -> DOMWrapperWorld
21 if (context.IsEmpty())
22 return false;
23 ScriptState* scriptState = ScriptState::from(context);
24 ScriptState::Scope scope(scriptState);
25 DOMWindow* window = scriptState->domWindow();
26 if (!window)
27 return false;
28 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
29
30 {% for argument in method.arguments %}
31 v8::Handle<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value }};
32 {% endfor %}
33 {% if method.arguments %}
34 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
35 {% else %}
36 v8::Handle<v8::Value> *argv = 0;
37 {% endif %}
38 // FIXME: Support exceptions thrown from Blink-in-JS.
39 v8::TryCatch block;
40 {% if method.v8_value_to_cpp_value != '' %}
41 v8::Handle<v8::Value> v8Value = BlinkInJSController::run(scriptState->isolat e(), "{{cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | len gth}}, argv);
abarth-chromium 2014/06/20 15:17:42 BlinkInJSController -> PrivateScriptController ?
42 if (block.HasCaught())
43 return false;
44 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
45 {{method.cpp_type}} cppValue = {{method.v8_value_to_cpp_value}};
46 if (block.HasCaught())
47 return false;
48 *output = cppValue;
49 {% else %}
50 BlinkInJSController::run(scriptState->isolate(), "{{cpp_class}}", "{{method. name}}", windowWrapper, {{method.arguments | length}}, argv);
51 if (block.HasCaught())
52 return false;
53 {% endif %}
54 return true;
55 }
56
57 {% endfor %}
58 } // namespace WebCore
59 {% endfilter %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698