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

Side by Side Diff: Source/bindings/templates/private_script_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::privat eScriptWorld());
21 if (context.IsEmpty())
22 return false;
23 ScriptState* scriptState = ScriptState::from(context);
24 if (!scriptState->executionContext() || !scriptState->domWindow())
25 return false;
26
27 ScriptState::Scope scope(scriptState);
28 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS tate->context()->Global(), 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 {# Empty array initializers are illegal in MSVC. #}
37 v8::Handle<v8::Value> *argv = 0;
38 {% endif %}
39 // FIXME: Support exceptions thrown from Blink-in-JS.
40 v8::TryCatch block;
41 {% if method.v8_value_to_cpp_value %}
42 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "{ {cpp_class}}", "{{method.name}}", windowWrapper, {{method.arguments | length}}, argv);
43 if (block.HasCaught())
44 return false;
45 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
46 {{method.cpp_type}} cppValue = {{method.v8_value_to_cpp_value}};
47 if (block.HasCaught())
48 return false;
49 *output = cppValue;
50 {% else %}{# void return type #}
51 PrivateScriptController::run(scriptState, "{{cpp_class}}", "{{method.name}}" , windowWrapper, {{method.arguments | length}}, argv);
52 if (block.HasCaught())
53 return false;
54 {% endif %}
55 return true;
56 }
57
58 {% endfor %}
59 } // namespace WebCore
60 {% endfilter %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/private_script_interface.h ('k') | Source/bindings/templates/templates.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698