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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 namespace WebCore { | 74 namespace WebCore { |
75 const WrapperTypeInfo V8TestTypedefs::wrapperTypeInfo = { gin::kEmbedderBlink, V
8TestTypedefs::domTemplate, V8TestTypedefs::derefObject, 0, 0, 0, V8TestTypedefs
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | 75 const WrapperTypeInfo V8TestTypedefs::wrapperTypeInfo = { gin::kEmbedderBlink, V
8TestTypedefs::domTemplate, V8TestTypedefs::derefObject, 0, 0, 0, V8TestTypedefs
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; |
76 | 76 |
77 namespace TestTypedefsV8Internal { | 77 namespace TestTypedefsV8Internal { |
78 | 78 |
79 template <typename T> void V8_USE(T) { } | 79 template <typename T> void V8_USE(T) { } |
80 | 80 |
81 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) | 81 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) |
82 { | 82 { |
83 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 83 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
84 v8SetReturnValue(info, static_cast<double>(imp->unsignedLongLongAttr())); | 84 v8SetReturnValue(info, static_cast<double>(impl->unsignedLongLongAttr())); |
85 } | 85 } |
86 | 86 |
87 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) | 87 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
88 { | 88 { |
89 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 89 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
90 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); | 90 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); |
91 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 91 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
92 } | 92 } |
93 | 93 |
94 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) | 94 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) |
95 { | 95 { |
96 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo
ngAttr", "TestTypedefs", info.Holder(), info.GetIsolate()); | 96 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo
ngAttr", "TestTypedefs", info.Holder(), info.GetIsolate()); |
97 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 97 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
98 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(jsValue, ex
ceptionState), exceptionState); | 98 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(jsValue, ex
ceptionState), exceptionState); |
99 imp->setUnsignedLongLongAttr(cppValue); | 99 impl->setUnsignedLongLongAttr(cppValue); |
100 } | 100 } |
101 | 101 |
102 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 102 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
103 { | 103 { |
104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
105 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); | 105 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); |
106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
107 } | 107 } |
108 | 108 |
109 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 109 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
110 { | 110 { |
111 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 111 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
112 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 112 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
113 int jsValue = imp->attrWithGetterException(exceptionState); | 113 int jsValue = impl->attrWithGetterException(exceptionState); |
114 if (UNLIKELY(exceptionState.throwIfNeeded())) | 114 if (UNLIKELY(exceptionState.throwIfNeeded())) |
115 return; | 115 return; |
116 v8SetReturnValueInt(info, jsValue); | 116 v8SetReturnValueInt(info, jsValue); |
117 } | 117 } |
118 | 118 |
119 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 119 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
120 { | 120 { |
121 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 121 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
122 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); | 122 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); |
123 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 123 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
124 } | 124 } |
125 | 125 |
126 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 126 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
127 { | 127 { |
128 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 128 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
129 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 129 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
130 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); | 130 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); |
131 imp->setAttrWithGetterException(cppValue); | 131 impl->setAttrWithGetterException(cppValue); |
132 } | 132 } |
133 | 133 |
134 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 134 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
135 { | 135 { |
136 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 136 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
137 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); | 137 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); |
138 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 138 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
139 } | 139 } |
140 | 140 |
141 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 141 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
142 { | 142 { |
143 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 143 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
144 v8SetReturnValueInt(info, imp->attrWithSetterException()); | 144 v8SetReturnValueInt(info, impl->attrWithSetterException()); |
145 } | 145 } |
146 | 146 |
147 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 147 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
148 { | 148 { |
149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
150 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); | 150 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); |
151 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 151 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
152 } | 152 } |
153 | 153 |
154 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 154 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
155 { | 155 { |
156 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 156 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
157 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 157 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
158 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); | 158 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), e
xceptionState); |
159 imp->setAttrWithSetterException(cppValue, exceptionState); | 159 impl->setAttrWithSetterException(cppValue, exceptionState); |
160 exceptionState.throwIfNeeded(); | 160 exceptionState.throwIfNeeded(); |
161 } | 161 } |
162 | 162 |
163 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 163 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
164 { | 164 { |
165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
166 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); | 166 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); |
167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
168 } | 168 } |
169 | 169 |
170 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 170 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
171 { | 171 { |
172 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 172 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
173 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); | 173 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
174 String jsValue = imp->stringAttrWithGetterException(exceptionState); | 174 String jsValue = impl->stringAttrWithGetterException(exceptionState); |
175 if (UNLIKELY(exceptionState.throwIfNeeded())) | 175 if (UNLIKELY(exceptionState.throwIfNeeded())) |
176 return; | 176 return; |
177 v8SetReturnValueString(info, jsValue, info.GetIsolate()); | 177 v8SetReturnValueString(info, jsValue, info.GetIsolate()); |
178 } | 178 } |
179 | 179 |
180 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 180 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
181 { | 181 { |
182 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 182 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
183 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); | 183 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); |
184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
185 } | 185 } |
186 | 186 |
187 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 187 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
188 { | 188 { |
189 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 189 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
190 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 190 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
191 imp->setStringAttrWithGetterException(cppValue); | 191 impl->setStringAttrWithGetterException(cppValue); |
192 } | 192 } |
193 | 193 |
194 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 194 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
195 { | 195 { |
196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
197 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); | 197 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); |
198 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 198 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
199 } | 199 } |
200 | 200 |
201 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 201 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
202 { | 202 { |
203 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 203 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
204 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetI
solate()); | 204 v8SetReturnValueString(info, impl->stringAttrWithSetterException(), info.Get
Isolate()); |
205 } | 205 } |
206 | 206 |
207 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 207 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
208 { | 208 { |
209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
210 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); | 210 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); |
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
212 } | 212 } |
213 | 213 |
214 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 214 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
215 { | 215 { |
216 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); | 216 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
217 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 217 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
218 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 218 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
219 imp->setStringAttrWithSetterException(cppValue, exceptionState); | 219 impl->setStringAttrWithSetterException(cppValue, exceptionState); |
220 exceptionState.throwIfNeeded(); | 220 exceptionState.throwIfNeeded(); |
221 } | 221 } |
222 | 222 |
223 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 223 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
224 { | 224 { |
225 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 225 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
226 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); | 226 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); |
227 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 227 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
228 } | 228 } |
229 | 229 |
(...skipping 12 matching lines...) Expand all Loading... |
242 info.This()->ForceSet(name, jsValue); | 242 info.This()->ForceSet(name, jsValue); |
243 } | 243 } |
244 | 244 |
245 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 245 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
246 { | 246 { |
247 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); | 247 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); |
248 } | 248 } |
249 | 249 |
250 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 250 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
251 { | 251 { |
252 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 252 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
253 if (UNLIKELY(info.Length() <= 0)) { | 253 if (UNLIKELY(info.Length() <= 0)) { |
254 imp->func(); | 254 impl->func(); |
255 return; | 255 return; |
256 } | 256 } |
257 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); | 257 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); |
258 imp->func(x); | 258 impl->func(x); |
259 } | 259 } |
260 | 260 |
261 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 261 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
262 { | 262 { |
263 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 263 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
264 TestTypedefsV8Internal::funcMethod(info); | 264 TestTypedefsV8Internal::funcMethod(info); |
265 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 265 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
266 } | 266 } |
267 | 267 |
268 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 268 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
269 { | 269 { |
270 if (UNLIKELY(info.Length() < 3)) { | 270 if (UNLIKELY(info.Length() < 3)) { |
271 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); | 271 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); |
272 return; | 272 return; |
273 } | 273 } |
274 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 274 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
275 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); | 275 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); |
276 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); | 276 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); |
277 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); | 277 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); |
278 if (UNLIKELY(info.Length() <= 3)) { | 278 if (UNLIKELY(info.Length() <= 3)) { |
279 imp->setShadow(width, height, blur); | 279 impl->setShadow(width, height, blur); |
280 return; | 280 return; |
281 } | 281 } |
282 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, info[3]); | 282 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, info[3]); |
283 if (UNLIKELY(info.Length() <= 4)) { | 283 if (UNLIKELY(info.Length() <= 4)) { |
284 imp->setShadow(width, height, blur, color); | 284 impl->setShadow(width, height, blur, color); |
285 return; | 285 return; |
286 } | 286 } |
287 V8TRYCATCH_VOID(float, alpha, static_cast<float>(info[4]->NumberValue())); | 287 V8TRYCATCH_VOID(float, alpha, static_cast<float>(info[4]->NumberValue())); |
288 imp->setShadow(width, height, blur, color, alpha); | 288 impl->setShadow(width, height, blur, color, alpha); |
289 } | 289 } |
290 | 290 |
291 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 291 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
292 { | 292 { |
293 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 293 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
294 TestTypedefsV8Internal::setShadowMethod(info); | 294 TestTypedefsV8Internal::setShadowMethod(info); |
295 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 295 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
296 } | 296 } |
297 | 297 |
298 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | 298 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
299 { | 299 { |
300 if (UNLIKELY(info.Length() < 1)) { | 300 if (UNLIKELY(info.Length() < 1)) { |
301 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in
fo.Length())), info.GetIsolate()); | 301 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in
fo.Length())), info.GetIsolate()); |
302 return; | 302 return; |
303 } | 303 } |
304 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 304 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
305 if (info.Length() <= 0 || !info[0]->IsFunction()) { | 305 if (info.Length() <= 0 || !info[0]->IsFunction()) { |
306 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no
t a function."), info.GetIsolate()); | 306 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac
kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no
t a function."), info.GetIsolate()); |
307 return; | 307 return; |
308 } | 308 } |
309 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac
e::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContext(info.
GetIsolate())); | 309 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac
e::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContext(info.
GetIsolate())); |
310 imp->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release()
); | 310 impl->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release(
)); |
311 } | 311 } |
312 | 312 |
313 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | 313 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
314 { | 314 { |
315 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 315 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
316 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info); | 316 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info); |
317 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 317 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
318 } | 318 } |
319 | 319 |
320 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) | 320 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) |
321 { | 321 { |
322 if (UNLIKELY(info.Length() < 1)) { | 322 if (UNLIKELY(info.Length() < 1)) { |
323 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); | 323 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); |
324 return; | 324 return; |
325 } | 325 } |
326 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 326 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
327 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN
ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate
()))); | 327 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN
ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate
()))); |
328 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); | 328 v8SetReturnValue(info, static_cast<double>(impl->methodWithSequenceArg(seque
nceArg))); |
329 } | 329 } |
330 | 330 |
331 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 331 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
332 { | 332 { |
333 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 333 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
334 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); | 334 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); |
335 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 335 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
336 } | 336 } |
337 | 337 |
338 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info
) | 338 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info
) |
339 { | 339 { |
340 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 340 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
341 bool result0Enabled = false; | 341 bool result0Enabled = false; |
342 RefPtr<Foo> result0; | 342 RefPtr<Foo> result0; |
343 bool result1Enabled = false; | 343 bool result1Enabled = false; |
344 RefPtr<Bar> result1; | 344 RefPtr<Bar> result1; |
345 imp->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1); | 345 impl->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1); |
346 if (result0Enabled) { | 346 if (result0Enabled) { |
347 v8SetReturnValue(info, result0.release()); | 347 v8SetReturnValue(info, result0.release()); |
348 return; | 348 return; |
349 } | 349 } |
350 if (result1Enabled) { | 350 if (result1Enabled) { |
351 v8SetReturnValue(info, result1.release()); | 351 v8SetReturnValue(info, result1.release()); |
352 return; | 352 return; |
353 } | 353 } |
354 v8SetReturnValueNull(info); | 354 v8SetReturnValueNull(info); |
355 } | 355 } |
356 | 356 |
357 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 357 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu
e>& info) |
358 { | 358 { |
359 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 359 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
360 TestTypedefsV8Internal::fooOrBarMethodMethod(info); | 360 TestTypedefsV8Internal::fooOrBarMethodMethod(info); |
361 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 361 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
362 } | 362 } |
363 | 363 |
364 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 364 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
365 { | 365 { |
366 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); | 366 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); |
367 if (UNLIKELY(info.Length() < 1)) { | 367 if (UNLIKELY(info.Length() < 1)) { |
368 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 368 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
369 exceptionState.throwIfNeeded(); | 369 exceptionState.throwIfNeeded(); |
370 return; | 370 return; |
371 } | 371 } |
372 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 372 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
373 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 373 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
374 Vector<String> result = imp->stringArrayFunction(values, exceptionState); | 374 Vector<String> result = impl->stringArrayFunction(values, exceptionState); |
375 if (exceptionState.throwIfNeeded()) | 375 if (exceptionState.throwIfNeeded()) |
376 return; | 376 return; |
377 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 377 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
378 } | 378 } |
379 | 379 |
380 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 380 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
381 { | 381 { |
382 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 382 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
383 TestTypedefsV8Internal::stringArrayFunctionMethod(info); | 383 TestTypedefsV8Internal::stringArrayFunctionMethod(info); |
384 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 384 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
385 } | 385 } |
386 | 386 |
387 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) | 387 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) |
388 { | 388 { |
389 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); | 389 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); |
390 if (UNLIKELY(info.Length() < 1)) { | 390 if (UNLIKELY(info.Length() < 1)) { |
391 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 391 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
392 exceptionState.throwIfNeeded(); | 392 exceptionState.throwIfNeeded(); |
393 return; | 393 return; |
394 } | 394 } |
395 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 395 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
396 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 396 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
397 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); | 397 Vector<String> result = impl->stringArrayFunction2(values, exceptionState); |
398 if (exceptionState.throwIfNeeded()) | 398 if (exceptionState.throwIfNeeded()) |
399 return; | 399 return; |
400 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 400 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
401 } | 401 } |
402 | 402 |
403 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 403 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
404 { | 404 { |
405 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 405 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
406 TestTypedefsV8Internal::stringArrayFunction2Method(info); | 406 TestTypedefsV8Internal::stringArrayFunction2Method(info); |
407 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 407 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
408 } | 408 } |
409 | 409 |
410 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 410 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
411 { | 411 { |
412 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); | 412 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
413 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 413 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); |
414 imp->methodWithException(exceptionState); | 414 impl->methodWithException(exceptionState); |
415 if (exceptionState.throwIfNeeded()) | 415 if (exceptionState.throwIfNeeded()) |
416 return; | 416 return; |
417 } | 417 } |
418 | 418 |
419 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 419 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
420 { | 420 { |
421 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 421 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
422 TestTypedefsV8Internal::methodWithExceptionMethod(info); | 422 TestTypedefsV8Internal::methodWithExceptionMethod(info); |
423 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 423 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
424 } | 424 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 fromInternalPointer(object)->deref(); | 548 fromInternalPointer(object)->deref(); |
549 } | 549 } |
550 | 550 |
551 template<> | 551 template<> |
552 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 552 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
553 { | 553 { |
554 return toV8(impl, creationContext, isolate); | 554 return toV8(impl, creationContext, isolate); |
555 } | 555 } |
556 | 556 |
557 } // namespace WebCore | 557 } // namespace WebCore |
OLD | NEW |