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

Side by Side Diff: Source/bindings/templates/interface.h

Issue 101443002: IDL compiler: remove redundant '_name' from template parameters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
1 {# http://www.chromium.org/blink/coding-style#TOC-License #} 1 {# http://www.chromium.org/blink/coding-style#TOC-License #}
2 /* 2 /*
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 {# FIXME: Rename to Python when switch #} 32 {# FIXME: Rename to Python when switch #}
33 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! 33 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
34 34
35 #ifndef {{v8_class_name}}_h 35 #ifndef {{v8_class}}_h
36 #define {{v8_class_name}}_h 36 #define {{v8_class}}_h
37 37
38 {% filter conditional(conditional_string) %} 38 {% filter conditional(conditional_string) %}
39 {% for filename in header_includes %} 39 {% for filename in header_includes %}
40 #include "{{filename}}" 40 #include "{{filename}}"
41 {% endfor %} 41 {% endfor %}
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 class {{v8_class_name}} { 45 class {{v8_class}} {
46 public: 46 public:
47 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); 47 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
48 static bool hasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); 48 static bool hasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
49 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 49 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
50 static {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object) 50 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object)
51 { 51 {
52 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8 DOMWrapperObjectIndex)); 52 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8 DOMWrapperObjectIndex));
53 } 53 }
54 static void derefObject(void*); 54 static void derefObject(void*);
55 static const WrapperTypeInfo wrapperTypeInfo; 55 static const WrapperTypeInfo wrapperTypeInfo;
56 {% if has_visit_dom_wrapper %} 56 {% if has_visit_dom_wrapper %}
57 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is olate*); 57 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is olate*);
58 {% endif %} 58 {% endif %}
59 {% if is_active_dom_object %} 59 {% if is_active_dom_object %}
60 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); 60 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
(...skipping 12 matching lines...) Expand all
73 {% if attribute.has_custom_setter %}{# FIXME: and not attribute.implemented_ by #} 73 {% if attribute.has_custom_setter %}{# FIXME: and not attribute.implemented_ by #}
74 {% filter conditional(attribute.conditional_string) %} 74 {% filter conditional(attribute.conditional_string) %}
75 static void {{attribute.name}}AttributeSetterCustom(v8::Local<v8::Value>, co nst v8::PropertyCallbackInfo<void>&); 75 static void {{attribute.name}}AttributeSetterCustom(v8::Local<v8::Value>, co nst v8::PropertyCallbackInfo<void>&);
76 {% endfilter %} 76 {% endfilter %}
77 {% endif %} 77 {% endif %}
78 {% endfor %} 78 {% endfor %}
79 {% if has_custom_legacy_call %} 79 {% if has_custom_legacy_call %}
80 static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&); 80 static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&);
81 {% endif %} 81 {% endif %}
82 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0 ; 82 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0 ;
83 static inline void* toInternalPointer({{cpp_class_name}}* impl) 83 static inline void* toInternalPointer({{cpp_class}}* impl)
84 { 84 {
85 return impl; 85 return impl;
86 } 86 }
87 87
88 static inline {{cpp_class_name}}* fromInternalPointer(void* object) 88 static inline {{cpp_class}}* fromInternalPointer(void* object)
89 { 89 {
90 return static_cast<{{cpp_class_name}}*>(object); 90 return static_cast<{{cpp_class}}*>(object);
91 } 91 }
92 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class_name}}*, v8::Isolate*){% if has_per_context_enabled_attributes %}; 92 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, {{cpp _class}}*, v8::Isolate*){% if has_per_context_enabled_attributes %};
93 {% else %} { } 93 {% else %} { }
94 {% endif %} 94 {% endif %}
95 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol ate*){% if has_per_context_enabled_attributes %}; 95 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol ate*){% if has_per_context_enabled_attributes %};
96 {% else %} { } 96 {% else %} { }
97 {% endif %} 97 {% endif %}
98 98
99 private: 99 private:
100 friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Objec t> creationContext, v8::Isolate*); 100 friend v8::Handle<v8::Object> wrap({{cpp_class}}*, v8::Handle<v8::Object> cr eationContext, v8::Isolate*);
101 static v8::Handle<v8::Object> createWrapper(PassRefPtr<{{cpp_class_name}}>, v8::Handle<v8::Object> creationContext, v8::Isolate*); 101 static v8::Handle<v8::Object> createWrapper(PassRefPtr<{{cpp_class}}>, v8::H andle<v8::Object> creationContext, v8::Isolate*);
102 }; 102 };
103 103
104 template<> 104 template<>
105 class WrapperTypeTraits<{{cpp_class_name}} > { 105 class WrapperTypeTraits<{{cpp_class}} > {
106 public: 106 public:
107 static const WrapperTypeInfo* wrapperTypeInfo() { return &{{v8_class_name}}: :wrapperTypeInfo; } 107 static const WrapperTypeInfo* wrapperTypeInfo() { return &{{v8_class}}::wrap perTypeInfo; }
108 }; 108 };
109 109
110 {% if has_custom_wrap %} 110 {% if has_custom_wrap %}
111 v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Object> cre ationContext, v8::Isolate*); 111 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*);
112 {% else %} 112 {% else %}
113 inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Obje ct> creationContext, v8::Isolate* isolate) 113 inline v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
114 { 114 {
115 ASSERT(impl); 115 ASSERT(impl);
116 ASSERT(!DOMDataStore::containsWrapper<{{v8_class_name}}>(impl, isolate)); 116 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl, isolate));
117 return {{v8_class_name}}::createWrapper(impl, creationContext, isolate); 117 return {{v8_class}}::createWrapper(impl, creationContext, isolate);
118 } 118 }
119 {% endif %} 119 {% endif %}
120 120
121 inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Objec t> creationContext, v8::Isolate* isolate) 121 inline v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
122 { 122 {
123 if (UNLIKELY(!impl)) 123 if (UNLIKELY(!impl))
124 return v8::Null(isolate); 124 return v8::Null(isolate);
125 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>( impl, isolate); 125 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class}}>(impl, isolate);
126 if (!wrapper.IsEmpty()) 126 if (!wrapper.IsEmpty())
127 return wrapper; 127 return wrapper;
128 return wrap(impl, creationContext, isolate); 128 return wrap(impl, creationContext, isolate);
129 } 129 }
130 130
131 template<typename CallbackInfo> 131 template<typename CallbackInfo>
132 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class_name} }* impl) 132 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}* im pl)
133 { 133 {
134 if (UNLIKELY(!impl)) { 134 if (UNLIKELY(!impl)) {
135 v8SetReturnValueNull(callbackInfo); 135 v8SetReturnValueNull(callbackInfo);
136 return; 136 return;
137 } 137 }
138 if (DOMDataStore::setReturnValueFromWrapper<{{v8_class_name}}>(callbackInfo. GetReturnValue(), impl)) 138 if (DOMDataStore::setReturnValueFromWrapper<{{v8_class}}>(callbackInfo.GetRe turnValue(), impl))
139 return; 139 return;
140 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate()); 140 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate());
141 v8SetReturnValue(callbackInfo, wrapper); 141 v8SetReturnValue(callbackInfo, wrapper);
142 } 142 }
143 143
144 template<typename CallbackInfo> 144 template<typename CallbackInfo>
145 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class_name}}* impl) 145 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class}}* impl)
146 { 146 {
147 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); 147 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
148 if (UNLIKELY(!impl)) { 148 if (UNLIKELY(!impl)) {
149 v8SetReturnValueNull(callbackInfo); 149 v8SetReturnValueNull(callbackInfo);
150 return; 150 return;
151 } 151 }
152 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<{{v8_class_name}}>(c allbackInfo.GetReturnValue(), impl)) 152 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<{{v8_class}}>(callba ckInfo.GetReturnValue(), impl))
153 return; 153 return;
154 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate()); 154 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate());
155 v8SetReturnValue(callbackInfo, wrapper); 155 v8SetReturnValue(callbackInfo, wrapper);
156 } 156 }
157 157
158 template<class CallbackInfo, class Wrappable> 158 template<class CallbackInfo, class Wrappable>
159 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class_n ame}}* impl, Wrappable* wrappable) 159 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class}} * impl, Wrappable* wrappable)
160 { 160 {
161 if (UNLIKELY(!impl)) { 161 if (UNLIKELY(!impl)) {
162 v8SetReturnValueNull(callbackInfo); 162 v8SetReturnValueNull(callbackInfo);
163 return; 163 return;
164 } 164 }
165 if (DOMDataStore::setReturnValueFromWrapperFast<{{v8_class_name}}>(callbackI nfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) 165 if (DOMDataStore::setReturnValueFromWrapperFast<{{v8_class}}>(callbackInfo.G etReturnValue(), impl, callbackInfo.Holder(), wrappable))
166 return; 166 return;
167 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate()); 167 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate());
168 v8SetReturnValue(callbackInfo, wrapper); 168 v8SetReturnValue(callbackInfo, wrapper);
169 } 169 }
170 170
171 inline v8::Handle<v8::Value> toV8(PassRefPtr<{{cpp_class_name}} > impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 171 inline v8::Handle<v8::Value> toV8(PassRefPtr<{{cpp_class}} > impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
172 { 172 {
173 return toV8(impl.get(), creationContext, isolate); 173 return toV8(impl.get(), creationContext, isolate);
174 } 174 }
175 175
176 template<class CallbackInfo> 176 template<class CallbackInfo>
177 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<{{cpp_ class_name}} > impl) 177 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<{{cpp_ class}} > impl)
178 { 178 {
179 v8SetReturnValue(callbackInfo, impl.get()); 179 v8SetReturnValue(callbackInfo, impl.get());
180 } 180 }
181 181
182 template<class CallbackInfo> 182 template<class CallbackInfo>
183 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR efPtr<{{cpp_class_name}} > impl) 183 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR efPtr<{{cpp_class}} > impl)
184 { 184 {
185 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); 185 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
186 } 186 }
187 187
188 template<class CallbackInfo, class Wrappable> 188 template<class CallbackInfo, class Wrappable>
189 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<{{ cpp_class_name}} > impl, Wrappable* wrappable) 189 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<{{ cpp_class}} > impl, Wrappable* wrappable)
190 { 190 {
191 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); 191 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
192 } 192 }
193 193
194 } 194 }
195 {% endfilter %} 195 {% endfilter %}
196 #endif // {{v8_class_name}}_h 196 #endif // {{v8_class}}_h
OLDNEW
« no previous file with comments | « Source/bindings/templates/callback_interface.cpp ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698