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

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

Issue 19607011: Generate binding code for VoidCallback.idl with code generator in python (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: fix double -> single quote etc Created 7 years, 5 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
OLDNEW
(Empty)
1 /*
2 This file is part of the Blink open source project.
haraken 2013/07/26 02:03:30 Ditto. Please use a proper copyright.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21 #include "config.h"
22 {% if conditional_string %}
23 #if {{conditional_string}}
24 {% endif %}
25 #include "{{v8_class_name}}.h"
26
27 {% for filename in implementation_includes %}
28 #include "{{filename}}"
29 {% endfor %}
haraken 2013/07/26 02:03:30 Nit: One empty line please below this line.
30 namespace WebCore {
31
32 {{v8_class_name}}::{{v8_class_name}}(v8::Handle<v8::Object> callback, ScriptExec utionContext* context)
33 : ActiveDOMCallback(context)
34 , m_callback(callback)
35 , m_world(DOMWrapperWorld::current())
36 {
37 }
38
39 {{v8_class_name}}::~{{v8_class_name}}()
40 {
41 }
42
43 // Functions
haraken 2013/07/26 02:03:30 Nit: I'd remove this comment.
44
45 {% for function in functions %}
46 {% if not function.custom %}
47 {{function["return_type"]}} {{v8_class_name}}::{{function["name"]}}({{function[" parameter_declaration"]}})
48 {
49 if (!canInvokeCallback())
50 return true;
51
52 v8::Isolate* isolate = v8::Isolate::GetCurrent();
53 v8::HandleScope handleScope(isolate);
54
55 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_ world.get());
56 if (v8Context.IsEmpty())
57 return true;
58
59 v8::Context::Scope scope(v8Context);
60
61 {% for parameter in function["parameters"] %}
62 {{parameter["native_to_js_value_statement"] | indent(4)}}
haraken 2013/07/26 02:03:30 Looks like "native_to_js_value_statement" is not d
kojih 2013/07/26 07:18:38 Removed this block since parameters are not suppor
63 if ({{parameter["name"]}}Handle.IsEmpty()) {
64 if (!isScriptControllerTerminating())
65 CRASH();
66 return true;
67 }
68 {% endfor %}
haraken 2013/07/26 02:03:30 Nit: Wrong indentation.
69
70 {% if function["parameters"] | length > 0 %}
71 v8::Handle<v8::Value> argv[] = {
72 {{function["handles"] | indent(8)}}
73 };
74 {% else %}
75 v8::Handle<v8::Value> *argv = 0;
76 {% endif %}
77
78 bool callbackReturnValue = false;
79 return !invokeCallback(m_callback.newLocal(isolate), {{function["parameters" ]|length}}, argv, callbackReturnValue, scriptExecutionContext());
haraken 2013/07/26 02:03:30 Nit: Spaces are needed around '|'.
80 }
81
82 {% endif %}
83 {% endfor %}
haraken 2013/07/26 02:03:30 Nit: You might want to add a jinja comment about w
84 } // namespace WebCore
85
86 {% if conditional_string %}
87 #endif // {{conditional_string}}
88 {% endif %}
89
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698