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

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: 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 TONATIVE_CONVERT(convertAndThrow(index = toUInt32(info[0], exceptionStat e), exceptionState), return);
51 } 51 }
52 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); 52 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
53 if (exceptionState.hadException()) { 53 if (exceptionState.hadException()) {
54 exceptionState.throwIfNeeded(); 54 exceptionState.throwIfNeeded();
55 return; 55 return;
56 } 56 }
57 v8SetReturnValue(info, result.release()); 57 v8SetReturnValue(info, result.release());
58 } 58 }
59 59
60 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 60 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
61 { 61 {
62 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 62 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
63 TestInterface2V8Internal::itemMethod(info); 63 TestInterface2V8Internal::itemMethod(info);
64 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 64 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
65 } 65 }
66 66
67 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 67 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
68 { 68 {
69 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate()); 69 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
70 if (UNLIKELY(info.Length() < 2)) { 70 if (UNLIKELY(info.Length() < 2)) {
71 setMinimumArityTypeError(exceptionState, 2, info.Length()); 71 setMinimumArityTypeError(exceptionState, 2, info.Length());
72 exceptionState.throwIfNeeded(); 72 exceptionState.throwIfNeeded();
73 return; 73 return;
74 } 74 }
75 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 75 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
76 unsigned index; 76 unsigned index;
77 TestInterfaceEmpty* value; 77 TestInterfaceEmpty* value;
78 { 78 {
79 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState); 79 TONATIVE_CONVERT(convertAndThrow(index = toUInt32(info[0], exceptionStat e), exceptionState), return);
80 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]); 80 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]);
81 if (!value) { 81 if (!value) {
82 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'."); 82 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
83 exceptionState.throwIfNeeded(); 83 exceptionState.throwIfNeeded();
84 return; 84 return;
85 } 85 }
86 } 86 }
87 RefPtr<TestInterfaceEmpty> result = impl->setItem(index, value, exceptionSta te); 87 RefPtr<TestInterfaceEmpty> result = impl->setItem(index, value, exceptionSta te);
88 if (exceptionState.hadException()) { 88 if (exceptionState.hadException()) {
89 exceptionState.throwIfNeeded(); 89 exceptionState.throwIfNeeded();
(...skipping 13 matching lines...) Expand all
103 { 103 {
104 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate()); 104 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
105 if (UNLIKELY(info.Length() < 1)) { 105 if (UNLIKELY(info.Length() < 1)) {
106 setMinimumArityTypeError(exceptionState, 1, info.Length()); 106 setMinimumArityTypeError(exceptionState, 1, info.Length());
107 exceptionState.throwIfNeeded(); 107 exceptionState.throwIfNeeded();
108 return; 108 return;
109 } 109 }
110 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 110 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
111 unsigned index; 111 unsigned index;
112 { 112 {
113 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState); 113 TONATIVE_CONVERT(convertAndThrow(index = toUInt32(info[0], exceptionStat e), exceptionState), return);
114 } 114 }
115 bool result = impl->deleteItem(index, exceptionState); 115 bool result = impl->deleteItem(index, exceptionState);
116 if (exceptionState.hadException()) { 116 if (exceptionState.hadException()) {
117 exceptionState.throwIfNeeded(); 117 exceptionState.throwIfNeeded();
118 return; 118 return;
119 } 119 }
120 v8SetReturnValueBool(info, result); 120 v8SetReturnValueBool(info, result);
121 } 121 }
122 122
123 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 123 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
124 { 124 {
125 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 125 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
126 TestInterface2V8Internal::deleteItemMethod(info); 126 TestInterface2V8Internal::deleteItemMethod(info);
127 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 127 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
128 } 128 }
129 129
130 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 130 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
131 { 131 {
132 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate()); 132 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
133 if (UNLIKELY(info.Length() < 1)) { 133 if (UNLIKELY(info.Length() < 1)) {
134 setMinimumArityTypeError(exceptionState, 1, info.Length()); 134 setMinimumArityTypeError(exceptionState, 1, info.Length());
135 exceptionState.throwIfNeeded(); 135 exceptionState.throwIfNeeded();
136 return; 136 return;
137 } 137 }
138 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 138 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
139 V8StringResource<> name; 139 V8StringResource<> name;
140 { 140 {
141 TOSTRING_VOID_INTERNAL(name, info[0]); 141 TONATIVE_CONVERT((name = info[0]).prepare(), return);
142 } 142 }
143 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); 143 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
144 if (exceptionState.hadException()) { 144 if (exceptionState.hadException()) {
145 exceptionState.throwIfNeeded(); 145 exceptionState.throwIfNeeded();
146 return; 146 return;
147 } 147 }
148 v8SetReturnValue(info, result.release()); 148 v8SetReturnValue(info, result.release());
149 } 149 }
150 150
151 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 151 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
152 { 152 {
153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
154 TestInterface2V8Internal::namedItemMethod(info); 154 TestInterface2V8Internal::namedItemMethod(info);
155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
156 } 156 }
157 157
158 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 158 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
159 { 159 {
160 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate()); 160 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
161 if (UNLIKELY(info.Length() < 2)) { 161 if (UNLIKELY(info.Length() < 2)) {
162 setMinimumArityTypeError(exceptionState, 2, info.Length()); 162 setMinimumArityTypeError(exceptionState, 2, info.Length());
163 exceptionState.throwIfNeeded(); 163 exceptionState.throwIfNeeded();
164 return; 164 return;
165 } 165 }
166 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 166 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
167 V8StringResource<> name; 167 V8StringResource<> name;
168 TestInterfaceEmpty* value; 168 TestInterfaceEmpty* value;
169 { 169 {
170 TOSTRING_VOID_INTERNAL(name, info[0]); 170 TONATIVE_CONVERT((name = info[0]).prepare(), return);
171 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]); 171 value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), inf o[1]);
172 if (!value && !isUndefinedOrNull(info[1])) { 172 if (!value && !isUndefinedOrNull(info[1])) {
173 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'."); 173 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
174 exceptionState.throwIfNeeded(); 174 exceptionState.throwIfNeeded();
175 return; 175 return;
176 } 176 }
177 } 177 }
178 RefPtr<TestInterfaceEmpty> result = impl->setNamedItem(name, value, exceptio nState); 178 RefPtr<TestInterfaceEmpty> result = impl->setNamedItem(name, value, exceptio nState);
179 if (exceptionState.hadException()) { 179 if (exceptionState.hadException()) {
180 exceptionState.throwIfNeeded(); 180 exceptionState.throwIfNeeded();
(...skipping 13 matching lines...) Expand all
194 { 194 {
195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate()); 195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
196 if (UNLIKELY(info.Length() < 1)) { 196 if (UNLIKELY(info.Length() < 1)) {
197 setMinimumArityTypeError(exceptionState, 1, info.Length()); 197 setMinimumArityTypeError(exceptionState, 1, info.Length());
198 exceptionState.throwIfNeeded(); 198 exceptionState.throwIfNeeded();
199 return; 199 return;
200 } 200 }
201 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 201 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
202 V8StringResource<> name; 202 V8StringResource<> name;
203 { 203 {
204 TOSTRING_VOID_INTERNAL(name, info[0]); 204 TONATIVE_CONVERT((name = info[0]).prepare(), return);
205 } 205 }
206 bool result = impl->deleteNamedItem(name, exceptionState); 206 bool result = impl->deleteNamedItem(name, exceptionState);
207 if (exceptionState.hadException()) { 207 if (exceptionState.hadException()) {
208 exceptionState.throwIfNeeded(); 208 exceptionState.throwIfNeeded();
209 return; 209 return;
210 } 210 }
211 v8SetReturnValueBool(info, result); 211 v8SetReturnValueBool(info, result);
212 } 212 }
213 213
214 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info) 214 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()); 298 setMinimumArityTypeError(exceptionState, 1, info.Length());
299 exceptionState.throwIfNeeded(); 299 exceptionState.throwIfNeeded();
300 return; 300 return;
301 } 301 }
302 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 302 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
303 ScriptValue callback; 303 ScriptValue callback;
304 ScriptValue thisArg; 304 ScriptValue thisArg;
305 { 305 {
306 if (!info[0]->IsFunction()) { 306 if (!info[0]->IsFunction()) {
307 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); 307 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
308 exceptionState.throwIfNeeded(); 308 exceptionState.throwIfNeeded();
309 return; 309 return;
310 } 310 }
311 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]) ; 311 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]) ;
312 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); 312 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]);
313 } 313 }
314 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 314 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
315 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState); 315 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState);
316 if (exceptionState.hadException()) { 316 if (exceptionState.hadException()) {
317 exceptionState.throwIfNeeded(); 317 exceptionState.throwIfNeeded();
318 return; 318 return;
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 { 693 {
694 scriptWrappable->toImpl<TestInterface2>()->ref(); 694 scriptWrappable->toImpl<TestInterface2>()->ref();
695 } 695 }
696 696
697 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable) 697 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable)
698 { 698 {
699 scriptWrappable->toImpl<TestInterface2>()->deref(); 699 scriptWrappable->toImpl<TestInterface2>()->deref();
700 } 700 }
701 701
702 } // namespace blink 702 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698