OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) | 75 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) |
76 { | 76 { |
77 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 77 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
78 v8SetReturnValue(info, static_cast<double>(imp->unsignedLongLongAttr())); | 78 v8SetReturnValue(info, static_cast<double>(imp->unsignedLongLongAttr())); |
79 } | 79 } |
80 | 80 |
81 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) | 81 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
82 { | 82 { |
83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
84 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); | 84 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); |
85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
86 } | 86 } |
87 | 87 |
88 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) | 88 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) |
89 { | 89 { |
90 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo
ngAttr", "TestTypedefs", info.Holder(), info.GetIsolate()); | 90 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo
ngAttr", "TestTypedefs", info.Holder(), info.GetIsolate()); |
91 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 91 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
92 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(jsValue, ex
ceptionState), exceptionState); | 92 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(jsValue, ex
ceptionState), exceptionState); |
93 imp->setUnsignedLongLongAttr(cppValue); | 93 imp->setUnsignedLongLongAttr(cppValue); |
94 } | 94 } |
95 | 95 |
96 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 96 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
97 { | 97 { |
98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
99 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); | 99 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); |
100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
101 } | 101 } |
102 | 102 |
103 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 103 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
104 { | 104 { |
105 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 105 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
106 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 106 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
107 int jsValue = imp->attrWithGetterException(exceptionState); | 107 int jsValue = imp->attrWithGetterException(exceptionState); |
108 if (UNLIKELY(exceptionState.throwIfNeeded())) | 108 if (UNLIKELY(exceptionState.throwIfNeeded())) |
109 return; | 109 return; |
110 v8SetReturnValueInt(info, jsValue); | 110 v8SetReturnValueInt(info, jsValue); |
111 } | 111 } |
112 | 112 |
113 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 113 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
114 { | 114 { |
115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
116 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); | 116 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); |
117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
118 } | 118 } |
119 | 119 |
120 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 120 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
121 { | 121 { |
122 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 122 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
123 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 123 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
124 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); | 124 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); |
125 imp->setAttrWithGetterException(cppValue); | 125 imp->setAttrWithGetterException(cppValue); |
126 } | 126 } |
127 | 127 |
128 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 128 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
129 { | 129 { |
130 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 130 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
131 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); | 131 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); |
132 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 132 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
133 } | 133 } |
134 | 134 |
135 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 135 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
136 { | 136 { |
137 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 137 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
138 v8SetReturnValueInt(info, imp->attrWithSetterException()); | 138 v8SetReturnValueInt(info, imp->attrWithSetterException()); |
139 } | 139 } |
140 | 140 |
141 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 141 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
142 { | 142 { |
143 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 143 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
144 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); | 144 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); |
145 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 145 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
146 } | 146 } |
147 | 147 |
148 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 148 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
149 { | 149 { |
150 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 150 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
151 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 151 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
152 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); | 152 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); |
153 imp->setAttrWithSetterException(cppValue, exceptionState); | 153 imp->setAttrWithSetterException(cppValue, exceptionState); |
154 exceptionState.throwIfNeeded(); | 154 exceptionState.throwIfNeeded(); |
155 } | 155 } |
156 | 156 |
157 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 157 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
158 { | 158 { |
159 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 159 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
160 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); | 160 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); |
161 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 161 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
162 } | 162 } |
163 | 163 |
164 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 164 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
165 { | 165 { |
166 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 166 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
167 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); | 167 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
168 String jsValue = imp->stringAttrWithGetterException(exceptionState); | 168 String jsValue = imp->stringAttrWithGetterException(exceptionState); |
169 if (UNLIKELY(exceptionState.throwIfNeeded())) | 169 if (UNLIKELY(exceptionState.throwIfNeeded())) |
170 return; | 170 return; |
171 v8SetReturnValueString(info, jsValue, info.GetIsolate()); | 171 v8SetReturnValueString(info, jsValue, info.GetIsolate()); |
172 } | 172 } |
173 | 173 |
174 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 174 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
175 { | 175 { |
176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
177 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); | 177 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); |
178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
179 } | 179 } |
180 | 180 |
181 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 181 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
182 { | 182 { |
183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
184 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 184 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
185 imp->setStringAttrWithGetterException(cppValue); | 185 imp->setStringAttrWithGetterException(cppValue); |
186 } | 186 } |
187 | 187 |
188 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 188 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
189 { | 189 { |
190 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 190 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
191 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); | 191 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); |
192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
193 } | 193 } |
194 | 194 |
195 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 195 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
196 { | 196 { |
197 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 197 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
198 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetI
solate()); | 198 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetI
solate()); |
199 } | 199 } |
200 | 200 |
201 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 201 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
202 { | 202 { |
203 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 203 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
204 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); | 204 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); |
205 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 205 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
206 } | 206 } |
207 | 207 |
208 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 208 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
209 { | 209 { |
210 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); | 210 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
211 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 211 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
212 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 212 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
213 imp->setStringAttrWithSetterException(cppValue, exceptionState); | 213 imp->setStringAttrWithSetterException(cppValue, exceptionState); |
214 exceptionState.throwIfNeeded(); | 214 exceptionState.throwIfNeeded(); |
215 } | 215 } |
216 | 216 |
217 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 217 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
218 { | 218 { |
219 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 219 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
220 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); | 220 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); |
221 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 221 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
222 } | 222 } |
223 | 223 |
224 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope
rtyCallbackInfo<v8::Value>& info) | 224 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope
rtyCallbackInfo<v8::Value>& info) |
225 { | 225 { |
226 v8::Handle<v8::Value> data = info.Data(); | 226 v8::Handle<v8::Value> data = info.Data(); |
227 ASSERT(data->IsExternal()); | 227 ASSERT(data->IsExternal()); |
228 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 228 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
229 if (!perContextData) | 229 if (!perContextData) |
230 return; | 230 return; |
231 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 231 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
(...skipping 17 matching lines...) Expand all Loading... |
249 return; | 249 return; |
250 } | 250 } |
251 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); | 251 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); |
252 imp->func(x); | 252 imp->func(x); |
253 } | 253 } |
254 | 254 |
255 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 255 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
256 { | 256 { |
257 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 257 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
258 TestTypedefsV8Internal::funcMethod(info); | 258 TestTypedefsV8Internal::funcMethod(info); |
259 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 259 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
260 } | 260 } |
261 | 261 |
262 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 262 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
263 { | 263 { |
264 if (UNLIKELY(info.Length() < 3)) { | 264 if (UNLIKELY(info.Length() < 3)) { |
265 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); | 265 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); |
266 return; | 266 return; |
267 } | 267 } |
268 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 268 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
269 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); | 269 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); |
270 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); | 270 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); |
271 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); | 271 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); |
272 if (UNLIKELY(info.Length() <= 3)) { | 272 if (UNLIKELY(info.Length() <= 3)) { |
273 imp->setShadow(width, height, blur); | 273 imp->setShadow(width, height, blur); |
274 return; | 274 return; |
275 } | 275 } |
276 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, info[3]); | 276 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, info[3]); |
277 if (UNLIKELY(info.Length() <= 4)) { | 277 if (UNLIKELY(info.Length() <= 4)) { |
278 imp->setShadow(width, height, blur, color); | 278 imp->setShadow(width, height, blur, color); |
279 return; | 279 return; |
280 } | 280 } |
281 V8TRYCATCH_VOID(float, alpha, static_cast<float>(info[4]->NumberValue())); | 281 V8TRYCATCH_VOID(float, alpha, static_cast<float>(info[4]->NumberValue())); |
282 imp->setShadow(width, height, blur, color, alpha); | 282 imp->setShadow(width, height, blur, color, alpha); |
283 } | 283 } |
284 | 284 |
285 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 285 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
286 { | 286 { |
287 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 287 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
288 TestTypedefsV8Internal::setShadowMethod(info); | 288 TestTypedefsV8Internal::setShadowMethod(info); |
289 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 289 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
290 } | 290 } |
291 | 291 |
292 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | 292 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
293 { | 293 { |
294 if (UNLIKELY(info.Length() < 1)) { | 294 if (UNLIKELY(info.Length() < 1)) { |
295 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in
fo.Length())), info.GetIsolate()); | 295 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in
fo.Length())), info.GetIsolate()); |
296 return; | 296 return; |
297 } | 297 } |
298 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 298 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
299 if (info.Length() <= 0 || !info[0]->IsFunction()) { | 299 if (info.Length() <= 0 || !info[0]->IsFunction()) { |
300 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no
t a function."), info.GetIsolate()); | 300 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no
t a function."), info.GetIsolate()); |
301 return; | 301 return; |
302 } | 302 } |
303 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac
e::create(v8::Handle<v8::Function>::Cast(info[0]), getExecutionContext()); | 303 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac
e::create(v8::Handle<v8::Function>::Cast(info[0]), getExecutionContext()); |
304 imp->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release()
); | 304 imp->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release()
); |
305 } | 305 } |
306 | 306 |
307 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | 307 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
308 { | 308 { |
309 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 309 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
310 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info); | 310 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info); |
311 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 311 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
312 } | 312 } |
313 | 313 |
314 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) | 314 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) |
315 { | 315 { |
316 if (UNLIKELY(info.Length() < 1)) { | 316 if (UNLIKELY(info.Length() < 1)) { |
317 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); | 317 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); |
318 return; | 318 return; |
319 } | 319 } |
320 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 320 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
321 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN
ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate
()))); | 321 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN
ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate
()))); |
322 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); | 322 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); |
323 } | 323 } |
324 | 324 |
325 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 325 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
326 { | 326 { |
327 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 327 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
328 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); | 328 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); |
329 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 329 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
330 } | 330 } |
331 | 331 |
332 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 332 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
333 { | 333 { |
334 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); | 334 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); |
335 if (UNLIKELY(info.Length() < 1)) { | 335 if (UNLIKELY(info.Length() < 1)) { |
336 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 336 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
337 exceptionState.throwIfNeeded(); | 337 exceptionState.throwIfNeeded(); |
338 return; | 338 return; |
339 } | 339 } |
340 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 340 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
341 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 341 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
342 Vector<String> result = imp->stringArrayFunction(values, exceptionState); | 342 Vector<String> result = imp->stringArrayFunction(values, exceptionState); |
343 if (exceptionState.throwIfNeeded()) | 343 if (exceptionState.throwIfNeeded()) |
344 return; | 344 return; |
345 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 345 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
346 } | 346 } |
347 | 347 |
348 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 348 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
349 { | 349 { |
350 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 350 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
351 TestTypedefsV8Internal::stringArrayFunctionMethod(info); | 351 TestTypedefsV8Internal::stringArrayFunctionMethod(info); |
352 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 352 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
353 } | 353 } |
354 | 354 |
355 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) | 355 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) |
356 { | 356 { |
357 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); | 357 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); |
358 if (UNLIKELY(info.Length() < 1)) { | 358 if (UNLIKELY(info.Length() < 1)) { |
359 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 359 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
360 exceptionState.throwIfNeeded(); | 360 exceptionState.throwIfNeeded(); |
361 return; | 361 return; |
362 } | 362 } |
363 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 363 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
364 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 364 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
365 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); | 365 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); |
366 if (exceptionState.throwIfNeeded()) | 366 if (exceptionState.throwIfNeeded()) |
367 return; | 367 return; |
368 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 368 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
369 } | 369 } |
370 | 370 |
371 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 371 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
372 { | 372 { |
373 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 373 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
374 TestTypedefsV8Internal::stringArrayFunction2Method(info); | 374 TestTypedefsV8Internal::stringArrayFunction2Method(info); |
375 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 375 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
376 } | 376 } |
377 | 377 |
378 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 378 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
379 { | 379 { |
380 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 380 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
381 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 381 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
382 imp->methodWithException(exceptionState); | 382 imp->methodWithException(exceptionState); |
383 if (exceptionState.throwIfNeeded()) | 383 if (exceptionState.throwIfNeeded()) |
384 return; | 384 return; |
385 } | 385 } |
386 | 386 |
387 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 387 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
388 { | 388 { |
389 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 389 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
390 TestTypedefsV8Internal::methodWithExceptionMethod(info); | 390 TestTypedefsV8Internal::methodWithExceptionMethod(info); |
391 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 391 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
392 } | 392 } |
393 | 393 |
394 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 394 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
395 { | 395 { |
396 if (UNLIKELY(info.Length() < 1)) { | 396 if (UNLIKELY(info.Length() < 1)) { |
397 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce
ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); | 397 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce
ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); |
398 return; | 398 return; |
399 } | 399 } |
400 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]); | 400 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]); |
401 RefPtr<TestTypedefs> impl = TestTypedefs::create(hello); | 401 RefPtr<TestTypedefs> impl = TestTypedefs::create(hello); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 fromInternalPointer(object)->deref(); | 513 fromInternalPointer(object)->deref(); |
514 } | 514 } |
515 | 515 |
516 template<> | 516 template<> |
517 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 517 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
518 { | 518 { |
519 return toV8(impl, creationContext, isolate); | 519 return toV8(impl, creationContext, isolate); |
520 } | 520 } |
521 | 521 |
522 } // namespace WebCore | 522 } // namespace WebCore |
OLD | NEW |