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

Side by Side Diff: Source/bindings/scripts/implementation.template

Issue 17572008: WIP IDL compiler rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: non-callback headers working Created 7 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
« no previous file with comments | « Source/bindings/scripts/header.template ('k') | Source/bindings/scripts/ir.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 This file is part of the Blink open source project.
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 #include "{{v8_class_name}}.h"
23 {{conditional_if}}
24
25 {%- for filename in includes %}
26 #include "{{ filename }}"
27 {%- endfor %}
28
29 namespace WebCore {
30
31 static void initializeScriptWrappableForInterface({{impl_class_name}}* object)
32 {
33 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
34 ScriptWrappable::setTypeInfoInObject(object, &{{v8_class_name}}::info);
35 else
36 ASSERT_NOT_REACHED();
37 }
38
39 } // namespace WebCore
40
41 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
42 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
43 // in the global namespace.
44 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
45 void webCoreInitializeScriptWrappableForInterface({{namespace_for_interface and "WebCore::" or ""}}{{impl_class_name}}* object)
46 {
47 WebCore::initializeScriptWrappableForInterface(object);
48 }
49
50 namespace WebCore {
51 WrapperTypeInfo {{v8_class_name}}::info = { {{v8_class_name}}::GetTemplate, {{v8 _class_name}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, {{roo t_for_gc}}, {{v8_class_name}}::installPerContextPrototypeProperties, {{parent_cl ass_info}}, {{wrapper_type_prototype}} };
52
53 namespace {{impl_class_name}}V8Internal {
54
55 template <typename T> void V8_USE(T) { }
56
57 } // namespace {{impl_class_name}}V8Internal
58
59 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current WorldType)
60 {
61 desc->ReadOnlyPrototype();
62
63 v8::Local<v8::Signature> defaultSignature;
64 {% if enabled_at_runtime %}
65 if (!{{enable_function}}())
66 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "", {{par ent_class_template}}, {{v8_class_name}}::internalFieldCount, 0, 0, 0, 0, isolate , currentWorldType);
67 else
68 {% endif %}
69 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "{{interface_ name}}", {{parent_class_template}}, {{v8_class_name}}::internalFieldCount,
70 {{configure_template_batched_attribute}}, {{configure_template_attribute _count}},
71 {{configure_template_batched_method}}, {{configure_template_method_count }}, isolate, currentWorldType);
72 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
73
74 // Custom toString template
75 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
76 return desc;
77 }
78
79 v8::Handle<v8::FunctionTemplate> {{v8_class_name}}::GetTemplate(v8::Isolate* iso late, WrapperWorldType currentWorldType)
80 {
81 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
82 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&info);
83 if (result != data->templateMap(currentWorldType).end())
84 return result->value.newLocal(isolate);
85
86 v8::HandleScope handleScope(isolate);
87 v8::Handle<v8::FunctionTemplate> templ =
88 Configure{{v8_class_name}}Template(data->rawTemplate(&info, currentWorld Type), isolate, currentWorldType);
89 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function Template>(isolate, templ));
90 return handleScope.Close(templ);
91 }
92
93 bool {{v8_class_name}}::HasInstance(v8::Handle<v8::Value> value, v8::Isolate* is olate, WrapperWorldType currentWorldType)
94 {
95 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType);
96 }
97
98 bool {{v8_class_name}}::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::I solate* isolate)
99 {
100 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
101 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld)
102 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d);
103 }
104
105 {% if inherits_extended_attribute_event_target %}
106 EventTarget* {{v8_class_name}}::toEventTarget(v8::Handle<v8::Object> object)
107 {
108 return toNative(object);
109 }
110 {% endif %}
111
112
113
114 } // namespace WebCore
115
116 {{conditional_endif}}
117
OLDNEW
« no previous file with comments | « Source/bindings/scripts/header.template ('k') | Source/bindings/scripts/ir.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698