| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) | 89 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
| 90 { | 90 { |
| 91 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 91 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 92 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); | 92 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); |
| 93 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 93 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) | 96 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) |
| 97 { | 97 { |
| 98 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo
ngAttr", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 98 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 99 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 99 V8TRYCATCH_VOID(unsigned long long, cppValue, toUInt64(jsValue)); | 100 V8TRYCATCH_VOID(unsigned long long, cppValue, toUInt64(jsValue)); |
| 100 imp->setUnsignedLongLongAttr(cppValue); | 101 imp->setUnsignedLongLongAttr(cppValue); |
| 101 } | 102 } |
| 102 | 103 |
| 103 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 104 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 104 { | 105 { |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 106 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); | 107 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(jsValue, info); |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 108 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 108 } | 109 } |
| 109 | 110 |
| 110 static void immutableSerializedScriptValueAttributeGetter(const v8::PropertyCall
backInfo<v8::Value>& info) | 111 static void immutableSerializedScriptValueAttributeGetter(const v8::PropertyCall
backInfo<v8::Value>& info) |
| 111 { | 112 { |
| 112 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 113 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 113 v8SetReturnValue(info, imp->immutableSerializedScriptValue() ? imp->immutabl
eSerializedScriptValue()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.Ge
tIsolate()))); | 114 v8SetReturnValue(info, imp->immutableSerializedScriptValue() ? imp->immutabl
eSerializedScriptValue()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.Ge
tIsolate()))); |
| 114 } | 115 } |
| 115 | 116 |
| 116 static void immutableSerializedScriptValueAttributeGetterCallback(v8::Local<v8::
String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 117 static void immutableSerializedScriptValueAttributeGetterCallback(v8::Local<v8::
String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 117 { | 118 { |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 119 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 119 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeGetter(info); | 120 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeGetter(info); |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 121 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 121 } | 122 } |
| 122 | 123 |
| 123 static void immutableSerializedScriptValueAttributeSetter(v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<void>& info) | 124 static void immutableSerializedScriptValueAttributeSetter(v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<void>& info) |
| 124 { | 125 { |
| 126 ExceptionState exceptionState(ExceptionState::SetterContext, "immutableSeria
lizedScriptValue", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 125 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 127 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 126 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); | 128 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); |
| 127 imp->setImmutableSerializedScriptValue(WTF::getPtr(cppValue)); | 129 imp->setImmutableSerializedScriptValue(WTF::getPtr(cppValue)); |
| 128 } | 130 } |
| 129 | 131 |
| 130 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8::
String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) | 132 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8::
String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
| 131 { | 133 { |
| 132 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 134 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 133 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu
e, info); | 135 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu
e, info); |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 136 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 135 } | 137 } |
| 136 | 138 |
| 137 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 139 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
| 138 { | 140 { |
| 139 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 141 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 140 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 142 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs" ,info.Holder(), info.GetIsolate()); |
| 141 int jsValue = imp->attrWithGetterException(exceptionState); | 143 int jsValue = imp->attrWithGetterException(exceptionState); |
| 142 if (UNLIKELY(exceptionState.throwIfNeeded())) | 144 if (UNLIKELY(exceptionState.throwIfNeeded())) |
| 143 return; | 145 return; |
| 144 v8SetReturnValueInt(info, jsValue); | 146 v8SetReturnValueInt(info, jsValue); |
| 145 } | 147 } |
| 146 | 148 |
| 147 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 149 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 148 { | 150 { |
| 149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 151 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 150 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); | 152 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); |
| 151 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 153 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 152 } | 154 } |
| 153 | 155 |
| 154 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 156 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
| 155 { | 157 { |
| 158 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 156 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 159 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 157 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 160 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
| 158 imp->setAttrWithGetterException(cppValue); | 161 imp->setAttrWithGetterException(cppValue); |
| 159 } | 162 } |
| 160 | 163 |
| 161 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 164 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 162 { | 165 { |
| 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 166 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 164 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); | 167 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(jsValue, info
); |
| 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 168 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 166 } | 169 } |
| 167 | 170 |
| 168 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 171 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
| 169 { | 172 { |
| 170 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 173 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 171 v8SetReturnValueInt(info, imp->attrWithSetterException()); | 174 v8SetReturnValueInt(info, imp->attrWithSetterException()); |
| 172 } | 175 } |
| 173 | 176 |
| 174 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 177 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 175 { | 178 { |
| 176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 177 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); | 180 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); |
| 178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 179 } | 182 } |
| 180 | 183 |
| 181 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 184 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
| 182 { | 185 { |
| 186 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 187 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 184 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 188 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
| 185 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 186 imp->setAttrWithSetterException(cppValue, exceptionState); | 189 imp->setAttrWithSetterException(cppValue, exceptionState); |
| 187 exceptionState.throwIfNeeded(); | 190 exceptionState.throwIfNeeded(); |
| 188 } | 191 } |
| 189 | 192 |
| 190 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 193 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 191 { | 194 { |
| 192 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 195 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 193 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); | 196 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); |
| 194 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 195 } | 198 } |
| 196 | 199 |
| 197 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 200 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
| 198 { | 201 { |
| 199 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 202 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 200 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 203 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs" ,info.Holder(), info.GetIsolate()); |
| 201 String jsValue = imp->stringAttrWithGetterException(exceptionState); | 204 String jsValue = imp->stringAttrWithGetterException(exceptionState); |
| 202 if (UNLIKELY(exceptionState.throwIfNeeded())) | 205 if (UNLIKELY(exceptionState.throwIfNeeded())) |
| 203 return; | 206 return; |
| 204 v8SetReturnValueString(info, jsValue, info.GetIsolate()); | 207 v8SetReturnValueString(info, jsValue, info.GetIsolate()); |
| 205 } | 208 } |
| 206 | 209 |
| 207 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 210 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 208 { | 211 { |
| 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 212 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 210 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); | 213 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); |
| 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 214 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 212 } | 215 } |
| 213 | 216 |
| 214 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 217 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
| 215 { | 218 { |
| 219 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
GetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 216 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 220 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 217 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 221 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 218 imp->setStringAttrWithGetterException(cppValue); | 222 imp->setStringAttrWithGetterException(cppValue); |
| 219 } | 223 } |
| 220 | 224 |
| 221 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 225 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
| 222 { | 226 { |
| 223 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 227 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 224 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); | 228 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(jsValue
, info); |
| 225 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 229 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 226 } | 230 } |
| 227 | 231 |
| 228 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 232 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
| 229 { | 233 { |
| 230 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 234 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 231 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetI
solate()); | 235 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetI
solate()); |
| 232 } | 236 } |
| 233 | 237 |
| 234 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 238 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 235 { | 239 { |
| 236 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 240 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 237 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); | 241 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); |
| 238 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 242 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 239 } | 243 } |
| 240 | 244 |
| 241 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 245 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
| 242 { | 246 { |
| 247 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 243 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 248 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 244 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 249 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 245 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 246 imp->setStringAttrWithSetterException(cppValue, exceptionState); | 250 imp->setStringAttrWithSetterException(cppValue, exceptionState); |
| 247 exceptionState.throwIfNeeded(); | 251 exceptionState.throwIfNeeded(); |
| 248 } | 252 } |
| 249 | 253 |
| 250 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 254 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
| 251 { | 255 { |
| 252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 256 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 253 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); | 257 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); |
| 254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 258 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 255 } | 259 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 269 info.This()->ForceSet(name, jsValue); | 273 info.This()->ForceSet(name, jsValue); |
| 270 } | 274 } |
| 271 | 275 |
| 272 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 276 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 273 { | 277 { |
| 274 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); | 278 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); |
| 275 } | 279 } |
| 276 | 280 |
| 277 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 281 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 278 { | 282 { |
| 283 ExceptionState exceptionState(ExceptionState::ExecutionContext, "func", "Tes
tTypedefs", info.Holder(), info.GetIsolate()); |
| 279 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 284 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 280 if (UNLIKELY(info.Length() <= 0)) { | 285 if (UNLIKELY(info.Length() <= 0)) { |
| 281 imp->func(); | 286 imp->func(); |
| 282 return; | 287 return; |
| 283 } | 288 } |
| 284 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); | 289 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); |
| 285 imp->func(x); | 290 imp->func(x); |
| 286 } | 291 } |
| 287 | 292 |
| 288 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 293 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 289 { | 294 { |
| 290 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 295 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 291 TestTypedefsV8Internal::funcMethod(info); | 296 TestTypedefsV8Internal::funcMethod(info); |
| 292 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 293 } | 298 } |
| 294 | 299 |
| 295 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 300 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 296 { | 301 { |
| 302 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setShadow",
"TestTypedefs", info.Holder(), info.GetIsolate()); |
| 297 if (UNLIKELY(info.Length() < 3)) { | 303 if (UNLIKELY(info.Length() < 3)) { |
| 298 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); | 304 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); |
| 299 return; | 305 return; |
| 300 } | 306 } |
| 301 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 307 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 302 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); | 308 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); |
| 303 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); | 309 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); |
| 304 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); | 310 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); |
| 305 if (UNLIKELY(info.Length() <= 3)) { | 311 if (UNLIKELY(info.Length() <= 3)) { |
| 306 imp->setShadow(width, height, blur); | 312 imp->setShadow(width, height, blur); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 317 | 323 |
| 318 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 324 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 319 { | 325 { |
| 320 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 321 TestTypedefsV8Internal::setShadowMethod(info); | 327 TestTypedefsV8Internal::setShadowMethod(info); |
| 322 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 323 } | 329 } |
| 324 | 330 |
| 325 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) | 331 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) |
| 326 { | 332 { |
| 333 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithS
equenceArg", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 327 if (UNLIKELY(info.Length() < 1)) { | 334 if (UNLIKELY(info.Length() < 1)) { |
| 328 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); | 335 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); |
| 329 return; | 336 return; |
| 330 } | 337 } |
| 331 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 338 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 332 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP
trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(info[0], 1, info.G
etIsolate()))); | 339 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP
trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(info[0], 1, info.G
etIsolate()))); |
| 333 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); | 340 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); |
| 334 } | 341 } |
| 335 | 342 |
| 336 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 343 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
| 337 { | 344 { |
| 338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 345 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 339 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); | 346 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); |
| 340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 347 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 341 } | 348 } |
| 342 | 349 |
| 343 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 350 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 344 { | 351 { |
| 352 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nullableArr
ayArg", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 345 if (UNLIKELY(info.Length() < 1)) { | 353 if (UNLIKELY(info.Length() < 1)) { |
| 346 throwTypeError(ExceptionMessages::failedToExecute("nullableArrayArg", "T
estTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get
Isolate()); | 354 throwTypeError(ExceptionMessages::failedToExecute("nullableArrayArg", "T
estTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get
Isolate()); |
| 347 return; | 355 return; |
| 348 } | 356 } |
| 349 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 357 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 350 bool arrayArgIsNull = info[0]->IsNull(); | 358 bool arrayArgIsNull = info[0]->IsNull(); |
| 351 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1,
info.GetIsolate())); | 359 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1,
info.GetIsolate())); |
| 352 imp->nullableArrayArg(arrayArgIsNull ? 0 : &arrayArg); | 360 imp->nullableArrayArg(arrayArgIsNull ? 0 : &arrayArg); |
| 353 } | 361 } |
| 354 | 362 |
| 355 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 363 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| 356 { | 364 { |
| 357 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 365 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 358 TestTypedefsV8Internal::nullableArrayArgMethod(info); | 366 TestTypedefsV8Internal::nullableArrayArgMethod(info); |
| 359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 367 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 360 } | 368 } |
| 361 | 369 |
| 362 static void immutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 370 static void immutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Valu
e>& info) |
| 363 { | 371 { |
| 372 ExceptionState exceptionState(ExceptionState::ExecutionContext, "immutablePo
intFunction", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 364 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 373 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 365 v8SetReturnValue(info, WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp-
>immutablePointFunction()))); | 374 v8SetReturnValue(info, WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp-
>immutablePointFunction()))); |
| 366 } | 375 } |
| 367 | 376 |
| 368 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) | 377 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) |
| 369 { | 378 { |
| 370 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 379 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 371 TestTypedefsV8Internal::immutablePointFunctionMethod(info); | 380 TestTypedefsV8Internal::immutablePointFunctionMethod(info); |
| 372 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 381 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 373 } | 382 } |
| 374 | 383 |
| 375 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 384 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 376 { | 385 { |
| 386 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 377 if (UNLIKELY(info.Length() < 1)) { | 387 if (UNLIKELY(info.Length() < 1)) { |
| 378 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); | 388 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); |
| 379 return; | 389 return; |
| 380 } | 390 } |
| 381 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 391 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 382 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 383 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 392 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 384 Vector<String> result = imp->stringArrayFunction(values, exceptionState); | 393 Vector<String> result = imp->stringArrayFunction(values, exceptionState); |
| 385 if (exceptionState.throwIfNeeded()) | 394 if (exceptionState.throwIfNeeded()) |
| 386 return; | 395 return; |
| 387 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 396 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 388 } | 397 } |
| 389 | 398 |
| 390 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 399 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 391 { | 400 { |
| 392 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 401 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 393 TestTypedefsV8Internal::stringArrayFunctionMethod(info); | 402 TestTypedefsV8Internal::stringArrayFunctionMethod(info); |
| 394 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 403 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 395 } | 404 } |
| 396 | 405 |
| 397 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) | 406 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) |
| 398 { | 407 { |
| 408 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 399 if (UNLIKELY(info.Length() < 1)) { | 409 if (UNLIKELY(info.Length() < 1)) { |
| 400 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); | 410 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); |
| 401 return; | 411 return; |
| 402 } | 412 } |
| 403 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 413 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 404 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 405 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 414 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 406 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); | 415 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); |
| 407 if (exceptionState.throwIfNeeded()) | 416 if (exceptionState.throwIfNeeded()) |
| 408 return; | 417 return; |
| 409 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 418 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 410 } | 419 } |
| 411 | 420 |
| 412 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 421 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 413 { | 422 { |
| 414 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 423 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 415 TestTypedefsV8Internal::stringArrayFunction2Method(info); | 424 TestTypedefsV8Internal::stringArrayFunction2Method(info); |
| 416 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 425 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 417 } | 426 } |
| 418 | 427 |
| 419 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 428 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 420 { | 429 { |
| 430 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 421 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 431 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 422 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 423 imp->methodWithException(exceptionState); | 432 imp->methodWithException(exceptionState); |
| 424 if (exceptionState.throwIfNeeded()) | 433 if (exceptionState.throwIfNeeded()) |
| 425 return; | 434 return; |
| 426 } | 435 } |
| 427 | 436 |
| 428 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 437 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 429 { | 438 { |
| 430 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 439 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 431 TestTypedefsV8Internal::methodWithExceptionMethod(info); | 440 TestTypedefsV8Internal::methodWithExceptionMethod(info); |
| 432 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 441 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 fromInternalPointer(object)->deref(); | 575 fromInternalPointer(object)->deref(); |
| 567 } | 576 } |
| 568 | 577 |
| 569 template<> | 578 template<> |
| 570 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 579 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 571 { | 580 { |
| 572 return toV8(impl, creationContext, isolate); | 581 return toV8(impl, creationContext, isolate); |
| 573 } | 582 } |
| 574 | 583 |
| 575 } // namespace WebCore | 584 } // namespace WebCore |
| OLD | NEW |