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

Side by Side Diff: Source/bindings/tests/results/core/V8TestInterface2.cpp

Issue 946973005: IDL: Drop value conversion (V8 -> C++) macros from generated code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 years, 10 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 "V8TestInterface2.h" 8 #include "V8TestInterface2.h"
9 9
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 29 matching lines...) Expand all
40 { 40 {
41 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate()); 41 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate());
42 if (UNLIKELY(info.Length() < 1)) { 42 if (UNLIKELY(info.Length() < 1)) {
43 setMinimumArityTypeError(exceptionState, 1, info.Length()); 43 setMinimumArityTypeError(exceptionState, 1, info.Length());
44 exceptionState.throwIfNeeded(); 44 exceptionState.throwIfNeeded();
45 return; 45 return;
46 } 46 }
47 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 47 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
48 unsigned index; 48 unsigned index;
49 { 49 {
50 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState); 50 index = toUInt32(info[0], exceptionState);
51 if (exceptionState.throwIfNeeded())
52 return;
51 } 53 }
52 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); 54 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
53 if (exceptionState.hadException()) { 55 if (exceptionState.hadException()) {
54 exceptionState.throwIfNeeded(); 56 exceptionState.throwIfNeeded();
55 return; 57 return;
56 } 58 }
57 v8SetReturnValue(info, result.release()); 59 v8SetReturnValue(info, result.release());
58 } 60 }
59 61
60 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 62 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
61 { 63 {
62 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 64 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
63 TestInterface2V8Internal::itemMethod(info); 65 TestInterface2V8Internal::itemMethod(info);
64 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 66 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
65 } 67 }
66 68
67 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 69 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
68 { 70 {
69 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate()); 71 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
70 if (UNLIKELY(info.Length() < 2)) { 72 if (UNLIKELY(info.Length() < 2)) {
71 setMinimumArityTypeError(exceptionState, 2, info.Length()); 73 setMinimumArityTypeError(exceptionState, 2, info.Length());
72 exceptionState.throwIfNeeded(); 74 exceptionState.throwIfNeeded();
73 return; 75 return;
74 } 76 }
75 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 77 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
76 unsigned index; 78 unsigned index;
77 TestInterfaceEmpty* value; 79 TestInterfaceEmpty* value;
78 { 80 {
79 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState); 81 index = toUInt32(info[0], exceptionState);
82 if (exceptionState.throwIfNeeded())
83 return;
80 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]); 84 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]);
81 if (!value) { 85 if (!value) {
82 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'."); 86 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
83 exceptionState.throwIfNeeded(); 87 exceptionState.throwIfNeeded();
84 return; 88 return;
85 } 89 }
86 } 90 }
87 RefPtr<TestInterfaceEmpty> result = impl->setItem(index, value, exceptionSta te); 91 RefPtr<TestInterfaceEmpty> result = impl->setItem(index, value, exceptionSta te);
88 if (exceptionState.hadException()) { 92 if (exceptionState.hadException()) {
89 exceptionState.throwIfNeeded(); 93 exceptionState.throwIfNeeded();
(...skipping 13 matching lines...) Expand all
103 { 107 {
104 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate()); 108 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
105 if (UNLIKELY(info.Length() < 1)) { 109 if (UNLIKELY(info.Length() < 1)) {
106 setMinimumArityTypeError(exceptionState, 1, info.Length()); 110 setMinimumArityTypeError(exceptionState, 1, info.Length());
107 exceptionState.throwIfNeeded(); 111 exceptionState.throwIfNeeded();
108 return; 112 return;
109 } 113 }
110 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 114 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
111 unsigned index; 115 unsigned index;
112 { 116 {
113 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState); 117 index = toUInt32(info[0], exceptionState);
118 if (exceptionState.throwIfNeeded())
119 return;
114 } 120 }
115 bool result = impl->deleteItem(index, exceptionState); 121 bool result = impl->deleteItem(index, exceptionState);
116 if (exceptionState.hadException()) { 122 if (exceptionState.hadException()) {
117 exceptionState.throwIfNeeded(); 123 exceptionState.throwIfNeeded();
118 return; 124 return;
119 } 125 }
120 v8SetReturnValueBool(info, result); 126 v8SetReturnValueBool(info, result);
121 } 127 }
122 128
123 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 129 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
124 { 130 {
125 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 131 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
126 TestInterface2V8Internal::deleteItemMethod(info); 132 TestInterface2V8Internal::deleteItemMethod(info);
127 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 133 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
128 } 134 }
129 135
130 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 136 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
131 { 137 {
132 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate()); 138 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
133 if (UNLIKELY(info.Length() < 1)) { 139 if (UNLIKELY(info.Length() < 1)) {
134 setMinimumArityTypeError(exceptionState, 1, info.Length()); 140 setMinimumArityTypeError(exceptionState, 1, info.Length());
135 exceptionState.throwIfNeeded(); 141 exceptionState.throwIfNeeded();
136 return; 142 return;
137 } 143 }
138 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 144 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
139 V8StringResource<> name; 145 V8StringResource<> name;
140 { 146 {
141 TOSTRING_VOID_INTERNAL(name, info[0]); 147 name = info[0];
148 if (!name.prepare())
149 return;
142 } 150 }
143 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); 151 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
144 if (exceptionState.hadException()) { 152 if (exceptionState.hadException()) {
145 exceptionState.throwIfNeeded(); 153 exceptionState.throwIfNeeded();
146 return; 154 return;
147 } 155 }
148 v8SetReturnValue(info, result.release()); 156 v8SetReturnValue(info, result.release());
149 } 157 }
150 158
151 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 159 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
152 { 160 {
153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 161 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
154 TestInterface2V8Internal::namedItemMethod(info); 162 TestInterface2V8Internal::namedItemMethod(info);
155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 163 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
156 } 164 }
157 165
158 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 166 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
159 { 167 {
160 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate()); 168 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
161 if (UNLIKELY(info.Length() < 2)) { 169 if (UNLIKELY(info.Length() < 2)) {
162 setMinimumArityTypeError(exceptionState, 2, info.Length()); 170 setMinimumArityTypeError(exceptionState, 2, info.Length());
163 exceptionState.throwIfNeeded(); 171 exceptionState.throwIfNeeded();
164 return; 172 return;
165 } 173 }
166 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 174 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
167 V8StringResource<> name; 175 V8StringResource<> name;
168 TestInterfaceEmpty* value; 176 TestInterfaceEmpty* value;
169 { 177 {
170 TOSTRING_VOID_INTERNAL(name, info[0]); 178 name = info[0];
179 if (!name.prepare())
180 return;
171 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]); 181 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]);
172 if (!value && !isUndefinedOrNull(info[1])) { 182 if (!value && !isUndefinedOrNull(info[1])) {
173 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'."); 183 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
174 exceptionState.throwIfNeeded(); 184 exceptionState.throwIfNeeded();
175 return; 185 return;
176 } 186 }
177 } 187 }
178 RefPtr<TestInterfaceEmpty> result = impl->setNamedItem(name, value, exceptio nState); 188 RefPtr<TestInterfaceEmpty> result = impl->setNamedItem(name, value, exceptio nState);
179 if (exceptionState.hadException()) { 189 if (exceptionState.hadException()) {
180 exceptionState.throwIfNeeded(); 190 exceptionState.throwIfNeeded();
(...skipping 13 matching lines...) Expand all
194 { 204 {
195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate()); 205 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
196 if (UNLIKELY(info.Length() < 1)) { 206 if (UNLIKELY(info.Length() < 1)) {
197 setMinimumArityTypeError(exceptionState, 1, info.Length()); 207 setMinimumArityTypeError(exceptionState, 1, info.Length());
198 exceptionState.throwIfNeeded(); 208 exceptionState.throwIfNeeded();
199 return; 209 return;
200 } 210 }
201 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 211 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
202 V8StringResource<> name; 212 V8StringResource<> name;
203 { 213 {
204 TOSTRING_VOID_INTERNAL(name, info[0]); 214 name = info[0];
215 if (!name.prepare())
216 return;
205 } 217 }
206 bool result = impl->deleteNamedItem(name, exceptionState); 218 bool result = impl->deleteNamedItem(name, exceptionState);
207 if (exceptionState.hadException()) { 219 if (exceptionState.hadException()) {
208 exceptionState.throwIfNeeded(); 220 exceptionState.throwIfNeeded();
209 return; 221 return;
210 } 222 }
211 v8SetReturnValueBool(info, result); 223 v8SetReturnValueBool(info, result);
212 } 224 }
213 225
214 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info) 226 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 setMinimumArityTypeError(exceptionState, 1, info.Length()); 310 setMinimumArityTypeError(exceptionState, 1, info.Length());
299 exceptionState.throwIfNeeded(); 311 exceptionState.throwIfNeeded();
300 return; 312 return;
301 } 313 }
302 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 314 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
303 ScriptValue callback; 315 ScriptValue callback;
304 ScriptValue thisArg; 316 ScriptValue thisArg;
305 { 317 {
306 if (!info[0]->IsFunction()) { 318 if (!info[0]->IsFunction()) {
307 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); 319 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
308 exceptionState.throwIfNeeded(); 320 exceptionState.throwIfNeeded();
309 return; 321 return;
310 } 322 }
311 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]) ; 323 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]) ;
312 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); 324 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]);
313 } 325 }
314 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 326 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
315 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState); 327 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState);
316 if (exceptionState.hadException()) { 328 if (exceptionState.hadException()) {
317 exceptionState.throwIfNeeded(); 329 exceptionState.throwIfNeeded();
318 return; 330 return;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return; 505 return;
494 auto nameString = name.As<v8::String>(); 506 auto nameString = name.As<v8::String>();
495 if (info.Holder()->HasRealNamedProperty(nameString)) 507 if (info.Holder()->HasRealNamedProperty(nameString))
496 return; 508 return;
497 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty ()) 509 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty ())
498 return; 510 return;
499 511
500 v8::String::Utf8Value namedProperty(nameString); 512 v8::String::Utf8Value namedProperty(nameString);
501 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate()); 513 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
502 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 514 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
503 TOSTRING_VOID(V8StringResource<>, propertyName, nameString); 515 V8StringResource<> propertyName(nameString);
516 if (!propertyName.prepare())
517 return;
504 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec k(info.GetIsolate(), v8Value); 518 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec k(info.GetIsolate(), v8Value);
505 if (!propertyValue && !isUndefinedOrNull(v8Value)) { 519 if (!propertyValue && !isUndefinedOrNull(v8Value)) {
506 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceEmpty'."); 520 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceEmpty'.");
507 exceptionState.throwIfNeeded(); 521 exceptionState.throwIfNeeded();
508 return; 522 return;
509 } 523 }
510 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState ); 524 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState );
511 if (exceptionState.throwIfNeeded()) 525 if (exceptionState.throwIfNeeded())
512 return; 526 return;
513 if (!result) 527 if (!result)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 { 707 {
694 scriptWrappable->toImpl<TestInterface2>()->ref(); 708 scriptWrappable->toImpl<TestInterface2>()->ref();
695 } 709 }
696 710
697 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable) 711 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable)
698 { 712 {
699 scriptWrappable->toImpl<TestInterface2>()->deref(); 713 scriptWrappable->toImpl<TestInterface2>()->deref();
700 } 714 }
701 715
702 } // namespace blink 716 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestInterface.cpp ('k') | Source/bindings/tests/results/core/V8TestInterface3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698