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

Side by Side Diff: Source/bindings/tests/results/V8TestTypedefs.cpp

Issue 265293004: Create fewer local v8::TryCatch objects in generated bindings code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added comment Created 6 years, 7 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestTypedefs.h" 8 #include "V8TestTypedefs.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 97 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
98 { 98 {
99 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info); 99 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info);
100 } 100 }
101 101
102 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) 102 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
103 { 103 {
104 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 104 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
105 if (UNLIKELY(info.Length() <= 0)) { 105 Vector<int> arrayOfLongsArg;
106 impl->voidMethodArrayOfLongsArg(); 106 {
107 return; 107 v8::TryCatch block;
108 if (UNLIKELY(info.Length() <= 0)) {
109 impl->voidMethodArrayOfLongsArg();
110 return;
111 }
112 TONATIVE_VOID_INTERNAL(arrayOfLongsArg, toNativeArray<int>(info[0], 1, i nfo.GetIsolate()));
108 } 113 }
109 TONATIVE_VOID(Vector<int>, arrayOfLongsArg, toNativeArray<int>(info[0], 1, i nfo.GetIsolate()));
110 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg); 114 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg);
111 } 115 }
112 116
113 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 117 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
114 { 118 {
115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 119 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
116 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info); 120 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info);
117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 121 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
118 } 122 }
119 123
120 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 124 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
121 { 125 {
122 if (UNLIKELY(info.Length() < 2)) { 126 if (UNLIKELY(info.Length() < 2)) {
123 throwMinimumArityTypeErrorForMethod("voidMethodFloatArgStringArg", "Test Typedefs", 2, info.Length(), info.GetIsolate()); 127 throwMinimumArityTypeErrorForMethod("voidMethodFloatArgStringArg", "Test Typedefs", 2, info.Length(), info.GetIsolate());
124 return; 128 return;
125 } 129 }
126 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 130 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
127 TONATIVE_VOID(float, floatArg, static_cast<float>(info[0]->NumberValue())); 131 float floatArg;
128 TOSTRING_VOID(V8StringResource<>, stringArg, info[1]); 132 V8StringResource<> stringArg;
133 {
134 v8::TryCatch block;
135 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[0]->NumberValue ()));
136 TOSTRING_VOID_INTERNAL_RETHROW(stringArg, info[1], block);
137 }
129 impl->voidMethodFloatArgStringArg(floatArg, stringArg); 138 impl->voidMethodFloatArgStringArg(floatArg, stringArg);
130 } 139 }
131 140
132 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 141 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
133 { 142 {
134 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 143 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
135 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info); 144 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info);
136 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 145 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
137 } 146 }
138 147
139 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info) 148 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info)
140 { 149 {
141 if (UNLIKELY(info.Length() < 1)) { 150 if (UNLIKELY(info.Length() < 1)) {
142 throwMinimumArityTypeErrorForMethod("voidMethodTestCallbackInterfaceType Arg", "TestTypedefs", 1, info.Length(), info.GetIsolate()); 151 throwMinimumArityTypeErrorForMethod("voidMethodTestCallbackInterfaceType Arg", "TestTypedefs", 1, info.Length(), info.GetIsolate());
143 return; 152 return;
144 } 153 }
145 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 154 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
146 if (info.Length() <= 0 || !info[0]->IsFunction()) { 155 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg;
147 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate()); 156 {
148 return; 157 if (info.Length() <= 0 || !info[0]->IsFunction()) {
158 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCal lbackInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate());
159 return;
160 }
161 testCallbackInterfaceTypeArg = V8TestCallbackInterface::create(v8::Handl e<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
149 } 162 }
150 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = V8TestCallbackI nterface::create(v8::Handle<v8::Function>::Cast(info[0]), ScriptState::current(i nfo.GetIsolate()));
151 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease()); 163 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease());
152 } 164 }
153 165
154 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info) 166 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info)
155 { 167 {
156 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 168 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
157 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info); 169 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info);
158 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 170 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
159 } 171 }
160 172
161 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info) 173 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info)
162 { 174 {
163 if (UNLIKELY(info.Length() < 1)) { 175 if (UNLIKELY(info.Length() < 1)) {
164 throwMinimumArityTypeErrorForMethod("uLongLongMethodTestInterfaceEmptyTy peSequenceArg", "TestTypedefs", 1, info.Length(), info.GetIsolate()); 176 throwMinimumArityTypeErrorForMethod("uLongLongMethodTestInterfaceEmptyTy peSequenceArg", "TestTypedefs", 1, info.Length(), info.GetIsolate());
165 return; 177 return;
166 } 178 }
167 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 179 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
168 TONATIVE_VOID(Vector<RefPtr<TestInterfaceEmpty> >, testInterfaceEmptyTypeSeq uenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0] , 1, info.GetIsolate()))); 180 Vector<RefPtr<TestInterfaceEmpty> > testInterfaceEmptyTypeSequenceArg;
181 {
182 v8::TryCatch block;
183 TONATIVE_VOID_INTERNAL(testInterfaceEmptyTypeSequenceArg, (toRefPtrNativ eArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate())) );
184 }
169 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); 185 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg)));
170 } 186 }
171 187
172 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 188 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
173 { 189 {
174 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 190 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
175 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info); 191 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info);
176 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
177 } 193 }
178 194
(...skipping 23 matching lines...) Expand all
202 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 218 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
203 } 219 }
204 220
205 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info) 221 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info)
206 { 222 {
207 if (UNLIKELY(info.Length() < 1)) { 223 if (UNLIKELY(info.Length() < 1)) {
208 throwMinimumArityTypeErrorForMethod("arrayOfStringsMethodArrayOfStringsA rg", "TestTypedefs", 1, info.Length(), info.GetIsolate()); 224 throwMinimumArityTypeErrorForMethod("arrayOfStringsMethodArrayOfStringsA rg", "TestTypedefs", 1, info.Length(), info.GetIsolate());
209 return; 225 return;
210 } 226 }
211 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 227 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
212 TONATIVE_VOID(Vector<String>, arrayOfStringsArg, toNativeArray<String>(info[ 0], 1, info.GetIsolate())); 228 Vector<String> arrayOfStringsArg;
229 {
230 v8::TryCatch block;
231 TONATIVE_VOID_INTERNAL(arrayOfStringsArg, toNativeArray<String>(info[0], 1, info.GetIsolate()));
232 }
213 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate())); 233 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate()));
214 } 234 }
215 235
216 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info) 236 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info)
217 { 237 {
218 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
219 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); 239 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info);
220 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
221 } 241 }
222 242
223 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 243 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
224 { 244 {
225 if (UNLIKELY(info.Length() < 1)) { 245 if (UNLIKELY(info.Length() < 1)) {
226 throwMinimumArityTypeErrorForMethod("stringArrayMethodStringArrayArg", " TestTypedefs", 1, info.Length(), info.GetIsolate()); 246 throwMinimumArityTypeErrorForMethod("stringArrayMethodStringArrayArg", " TestTypedefs", 1, info.Length(), info.GetIsolate());
227 return; 247 return;
228 } 248 }
229 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 249 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
230 TONATIVE_VOID(Vector<String>, stringArrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate())); 250 Vector<String> stringArrayArg;
251 {
252 v8::TryCatch block;
253 TONATIVE_VOID_INTERNAL(stringArrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate()));
254 }
231 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate())); 255 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate()));
232 } 256 }
233 257
234 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 258 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
235 { 259 {
236 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 260 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
237 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); 261 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info);
238 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 262 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
239 } 263 }
240 264
241 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 265 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
242 { 266 {
243 v8::Isolate* isolate = info.GetIsolate(); 267 v8::Isolate* isolate = info.GetIsolate();
244 if (UNLIKELY(info.Length() < 1)) { 268 if (UNLIKELY(info.Length() < 1)) {
245 throwMinimumArityTypeErrorForConstructor("TestTypedefs", 1, info.Length( ), info.GetIsolate()); 269 throwMinimumArityTypeErrorForConstructor("TestTypedefs", 1, info.Length( ), info.GetIsolate());
246 return; 270 return;
247 } 271 }
248 TOSTRING_VOID(V8StringResource<>, stringArg, info[0]); 272 V8StringResource<> stringArg;
273 {
274 TOSTRING_VOID_INTERNAL(stringArg, info[0]);
275 }
249 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); 276 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg);
250 277
251 v8::Handle<v8::Object> wrapper = info.Holder(); 278 v8::Handle<v8::Object> wrapper = info.Holder();
252 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt); 279 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt);
253 v8SetReturnValue(info, wrapper); 280 v8SetReturnValue(info, wrapper);
254 } 281 }
255 282
256 } // namespace TestTypedefsV8Internal 283 } // namespace TestTypedefsV8Internal
257 284
258 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = { 285 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 fromInternalPointer(object)->deref(); 386 fromInternalPointer(object)->deref();
360 } 387 }
361 388
362 template<> 389 template<>
363 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 390 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
364 { 391 {
365 return toV8(impl, creationContext, isolate); 392 return toV8(impl, creationContext, isolate);
366 } 393 }
367 394
368 } // namespace WebCore 395 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestSpecialOperations.cpp ('k') | Source/bindings/v8/V8BindingMacros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698