| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "bindings/core/v8/UnionTypesCore.h" | 8 #include "bindings/core/v8/UnionTypesCore.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/Dictionary.h" | 10 #include "bindings/core/v8/Dictionary.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return m_dictionary; | 68 return m_dictionary; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ArrayBufferOrArrayBufferViewOrDictionary::setDictionary(Dictionary value) | 71 void ArrayBufferOrArrayBufferViewOrDictionary::setDictionary(Dictionary value) |
| 72 { | 72 { |
| 73 ASSERT(isNull()); | 73 ASSERT(isNull()); |
| 74 m_dictionary = value; | 74 m_dictionary = value; |
| 75 m_type = SpecificTypeDictionary; | 75 m_type = SpecificTypeDictionary; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8
::Handle<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, Exc
eptionState& exceptionState) | 78 void V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8
::Local<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, Exce
ptionState& exceptionState) |
| 79 { | 79 { |
| 80 if (v8Value.IsEmpty()) | 80 if (v8Value.IsEmpty()) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { | 83 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { |
| 84 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Handle<v8::
Object>::Cast(v8Value)); | 84 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O
bject>::Cast(v8Value)); |
| 85 impl.setArrayBuffer(cppValue); | 85 impl.setArrayBuffer(cppValue); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { | 89 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { |
| 90 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Han
dle<v8::Object>::Cast(v8Value)); | 90 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc
al<v8::Object>::Cast(v8Value)); |
| 91 impl.setArrayBufferView(cppValue); | 91 impl.setArrayBufferView(cppValue); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { | 95 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
| 96 TONATIVE_VOID_EXCEPTIONSTATE(Dictionary, cppValue, Dictionary(v8Value, i
solate, exceptionState), exceptionState); | 96 TONATIVE_VOID_EXCEPTIONSTATE(Dictionary, cppValue, Dictionary(v8Value, i
solate, exceptionState), exceptionState); |
| 97 impl.setDictionary(cppValue); | 97 impl.setDictionary(cppValue); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 | 100 |
| 101 exceptionState.throwTypeError("The provided value is not of type '(ArrayBuff
er or ArrayBufferView or Dictionary)'"); | 101 exceptionState.throwTypeError("The provided value is not of type '(ArrayBuff
er or ArrayBufferView or Dictionary)'"); |
| 102 } | 102 } |
| 103 | 103 |
| 104 v8::Handle<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary& impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 104 v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary& impl,
v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 105 { | 105 { |
| 106 switch (impl.m_type) { | 106 switch (impl.m_type) { |
| 107 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeNone: | 107 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeNone: |
| 108 return v8::Null(isolate); | 108 return v8::Null(isolate); |
| 109 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBuffer: | 109 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBuffer: |
| 110 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); | 110 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); |
| 111 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBufferView: | 111 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBufferView: |
| 112 return toV8(impl.getAsArrayBufferView(), creationContext, isolate); | 112 return toV8(impl.getAsArrayBufferView(), creationContext, isolate); |
| 113 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeDictionary: | 113 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeDictionary: |
| 114 return impl.getAsDictionary().v8Value(); | 114 return impl.getAsDictionary().v8Value(); |
| 115 default: | 115 default: |
| 116 ASSERT_NOT_REACHED(); | 116 ASSERT_NOT_REACHED(); |
| 117 } | 117 } |
| 118 return v8::Handle<v8::Value>(); | 118 return v8::Local<v8::Value>(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 ArrayBufferOrArrayBufferViewOrDictionary NativeValueTraits<ArrayBufferOrArrayBuf
ferViewOrDictionary>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolat
e* isolate, ExceptionState& exceptionState) | 121 ArrayBufferOrArrayBufferViewOrDictionary NativeValueTraits<ArrayBufferOrArrayBuf
ferViewOrDictionary>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate
* isolate, ExceptionState& exceptionState) |
| 122 { | 122 { |
| 123 ArrayBufferOrArrayBufferViewOrDictionary impl; | 123 ArrayBufferOrArrayBufferViewOrDictionary impl; |
| 124 V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(isolate, value, impl, exc
eptionState); | 124 V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(isolate, value, impl, exc
eptionState); |
| 125 return impl; | 125 return impl; |
| 126 } | 126 } |
| 127 | 127 |
| 128 BooleanOrStringOrUnrestrictedDouble::BooleanOrStringOrUnrestrictedDouble() | 128 BooleanOrStringOrUnrestrictedDouble::BooleanOrStringOrUnrestrictedDouble() |
| 129 : m_type(SpecificTypeNone) | 129 : m_type(SpecificTypeNone) |
| 130 { | 130 { |
| 131 } | 131 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 162 return m_unrestrictedDouble; | 162 return m_unrestrictedDouble; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void BooleanOrStringOrUnrestrictedDouble::setUnrestrictedDouble(double value) | 165 void BooleanOrStringOrUnrestrictedDouble::setUnrestrictedDouble(double value) |
| 166 { | 166 { |
| 167 ASSERT(isNull()); | 167 ASSERT(isNull()); |
| 168 m_unrestrictedDouble = value; | 168 m_unrestrictedDouble = value; |
| 169 m_type = SpecificTypeUnrestrictedDouble; | 169 m_type = SpecificTypeUnrestrictedDouble; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Han
dle<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionStat
e& exceptionState) | 172 void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Loc
al<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionState
& exceptionState) |
| 173 { | 173 { |
| 174 if (v8Value.IsEmpty()) | 174 if (v8Value.IsEmpty()) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 if (v8Value->IsBoolean()) { | 177 if (v8Value->IsBoolean()) { |
| 178 impl.setBoolean(v8Value->ToBoolean()->Value()); | 178 impl.setBoolean(v8Value->ToBoolean()->Value()); |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (v8Value->IsNumber()) { | 182 if (v8Value->IsNumber()) { |
| 183 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); | 183 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); |
| 184 impl.setUnrestrictedDouble(cppValue); | 184 impl.setUnrestrictedDouble(cppValue); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 { | 188 { |
| 189 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); | 189 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); |
| 190 impl.setString(cppValue); | 190 impl.setString(cppValue); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 } | 194 } |
| 195 | 195 |
| 196 v8::Handle<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble& impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 196 v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble& impl, v8::L
ocal<v8::Object> creationContext, v8::Isolate* isolate) |
| 197 { | 197 { |
| 198 switch (impl.m_type) { | 198 switch (impl.m_type) { |
| 199 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone: | 199 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone: |
| 200 return v8::Null(isolate); | 200 return v8::Null(isolate); |
| 201 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean: | 201 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean: |
| 202 return v8Boolean(impl.getAsBoolean(), isolate); | 202 return v8Boolean(impl.getAsBoolean(), isolate); |
| 203 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeString: | 203 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeString: |
| 204 return v8String(isolate, impl.getAsString()); | 204 return v8String(isolate, impl.getAsString()); |
| 205 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeUnrestrictedDouble: | 205 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeUnrestrictedDouble: |
| 206 return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); | 206 return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); |
| 207 default: | 207 default: |
| 208 ASSERT_NOT_REACHED(); | 208 ASSERT_NOT_REACHED(); |
| 209 } | 209 } |
| 210 return v8::Handle<v8::Value>(); | 210 return v8::Local<v8::Value>(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 BooleanOrStringOrUnrestrictedDouble NativeValueTraits<BooleanOrStringOrUnrestric
tedDouble>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate
, ExceptionState& exceptionState) | 213 BooleanOrStringOrUnrestrictedDouble NativeValueTraits<BooleanOrStringOrUnrestric
tedDouble>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate,
ExceptionState& exceptionState) |
| 214 { | 214 { |
| 215 BooleanOrStringOrUnrestrictedDouble impl; | 215 BooleanOrStringOrUnrestrictedDouble impl; |
| 216 V8BooleanOrStringOrUnrestrictedDouble::toImpl(isolate, value, impl, exceptio
nState); | 216 V8BooleanOrStringOrUnrestrictedDouble::toImpl(isolate, value, impl, exceptio
nState); |
| 217 return impl; | 217 return impl; |
| 218 } | 218 } |
| 219 | 219 |
| 220 DoubleOrString::DoubleOrString() | 220 DoubleOrString::DoubleOrString() |
| 221 : m_type(SpecificTypeNone) | 221 : m_type(SpecificTypeNone) |
| 222 { | 222 { |
| 223 } | 223 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 241 return m_string; | 241 return m_string; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void DoubleOrString::setString(String value) | 244 void DoubleOrString::setString(String value) |
| 245 { | 245 { |
| 246 ASSERT(isNull()); | 246 ASSERT(isNull()); |
| 247 m_string = value; | 247 m_string = value; |
| 248 m_type = SpecificTypeString; | 248 m_type = SpecificTypeString; |
| 249 } | 249 } |
| 250 | 250 |
| 251 void V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Valu
e, DoubleOrString& impl, ExceptionState& exceptionState) | 251 void V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
, DoubleOrString& impl, ExceptionState& exceptionState) |
| 252 { | 252 { |
| 253 if (v8Value.IsEmpty()) | 253 if (v8Value.IsEmpty()) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 if (v8Value->IsNumber()) { | 256 if (v8Value->IsNumber()) { |
| 257 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); | 257 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); |
| 258 impl.setDouble(cppValue); | 258 impl.setDouble(cppValue); |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 | 261 |
| 262 { | 262 { |
| 263 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); | 263 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); |
| 264 impl.setString(cppValue); | 264 impl.setString(cppValue); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 } | 268 } |
| 269 | 269 |
| 270 v8::Handle<v8::Value> toV8(const DoubleOrString& impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 270 v8::Local<v8::Value> toV8(const DoubleOrString& impl, v8::Local<v8::Object> crea
tionContext, v8::Isolate* isolate) |
| 271 { | 271 { |
| 272 switch (impl.m_type) { | 272 switch (impl.m_type) { |
| 273 case DoubleOrString::SpecificTypeNone: | 273 case DoubleOrString::SpecificTypeNone: |
| 274 return v8::Null(isolate); | 274 return v8::Null(isolate); |
| 275 case DoubleOrString::SpecificTypeDouble: | 275 case DoubleOrString::SpecificTypeDouble: |
| 276 return v8::Number::New(isolate, impl.getAsDouble()); | 276 return v8::Number::New(isolate, impl.getAsDouble()); |
| 277 case DoubleOrString::SpecificTypeString: | 277 case DoubleOrString::SpecificTypeString: |
| 278 return v8String(isolate, impl.getAsString()); | 278 return v8String(isolate, impl.getAsString()); |
| 279 default: | 279 default: |
| 280 ASSERT_NOT_REACHED(); | 280 ASSERT_NOT_REACHED(); |
| 281 } | 281 } |
| 282 return v8::Handle<v8::Value>(); | 282 return v8::Local<v8::Value>(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 DoubleOrString NativeValueTraits<DoubleOrString>::nativeValue(const v8::Handle<v
8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | 285 DoubleOrString NativeValueTraits<DoubleOrString>::nativeValue(const v8::Local<v8
::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| 286 { | 286 { |
| 287 DoubleOrString impl; | 287 DoubleOrString impl; |
| 288 V8DoubleOrString::toImpl(isolate, value, impl, exceptionState); | 288 V8DoubleOrString::toImpl(isolate, value, impl, exceptionState); |
| 289 return impl; | 289 return impl; |
| 290 } | 290 } |
| 291 | 291 |
| 292 NodeOrNodeList::NodeOrNodeList() | 292 NodeOrNodeList::NodeOrNodeList() |
| 293 : m_type(SpecificTypeNone) | 293 : m_type(SpecificTypeNone) |
| 294 { | 294 { |
| 295 } | 295 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 319 m_nodeList = value; | 319 m_nodeList = value; |
| 320 m_type = SpecificTypeNodeList; | 320 m_type = SpecificTypeNodeList; |
| 321 } | 321 } |
| 322 | 322 |
| 323 void NodeOrNodeList::trace(Visitor* visitor) | 323 void NodeOrNodeList::trace(Visitor* visitor) |
| 324 { | 324 { |
| 325 visitor->trace(m_node); | 325 visitor->trace(m_node); |
| 326 visitor->trace(m_nodeList); | 326 visitor->trace(m_nodeList); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Valu
e, NodeOrNodeList& impl, ExceptionState& exceptionState) | 329 void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
, NodeOrNodeList& impl, ExceptionState& exceptionState) |
| 330 { | 330 { |
| 331 if (v8Value.IsEmpty()) | 331 if (v8Value.IsEmpty()) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 if (V8Node::hasInstance(v8Value, isolate)) { | 334 if (V8Node::hasInstance(v8Value, isolate)) { |
| 335 RefPtrWillBeRawPtr<Node> cppValue = V8Node::toImpl(v8::Handle<v8::Object
>::Cast(v8Value)); | 335 RefPtrWillBeRawPtr<Node> cppValue = V8Node::toImpl(v8::Local<v8::Object>
::Cast(v8Value)); |
| 336 impl.setNode(cppValue); | 336 impl.setNode(cppValue); |
| 337 return; | 337 return; |
| 338 } | 338 } |
| 339 | 339 |
| 340 if (V8NodeList::hasInstance(v8Value, isolate)) { | 340 if (V8NodeList::hasInstance(v8Value, isolate)) { |
| 341 RefPtrWillBeRawPtr<NodeList> cppValue = V8NodeList::toImpl(v8::Handle<v8
::Object>::Cast(v8Value)); | 341 RefPtrWillBeRawPtr<NodeList> cppValue = V8NodeList::toImpl(v8::Local<v8:
:Object>::Cast(v8Value)); |
| 342 impl.setNodeList(cppValue); | 342 impl.setNodeList(cppValue); |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 | 345 |
| 346 exceptionState.throwTypeError("The provided value is not of type '(Node or N
odeList)'"); | 346 exceptionState.throwTypeError("The provided value is not of type '(Node or N
odeList)'"); |
| 347 } | 347 } |
| 348 | 348 |
| 349 v8::Handle<v8::Value> toV8(const NodeOrNodeList& impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 349 v8::Local<v8::Value> toV8(const NodeOrNodeList& impl, v8::Local<v8::Object> crea
tionContext, v8::Isolate* isolate) |
| 350 { | 350 { |
| 351 switch (impl.m_type) { | 351 switch (impl.m_type) { |
| 352 case NodeOrNodeList::SpecificTypeNone: | 352 case NodeOrNodeList::SpecificTypeNone: |
| 353 return v8::Null(isolate); | 353 return v8::Null(isolate); |
| 354 case NodeOrNodeList::SpecificTypeNode: | 354 case NodeOrNodeList::SpecificTypeNode: |
| 355 return toV8(impl.getAsNode(), creationContext, isolate); | 355 return toV8(impl.getAsNode(), creationContext, isolate); |
| 356 case NodeOrNodeList::SpecificTypeNodeList: | 356 case NodeOrNodeList::SpecificTypeNodeList: |
| 357 return toV8(impl.getAsNodeList(), creationContext, isolate); | 357 return toV8(impl.getAsNodeList(), creationContext, isolate); |
| 358 default: | 358 default: |
| 359 ASSERT_NOT_REACHED(); | 359 ASSERT_NOT_REACHED(); |
| 360 } | 360 } |
| 361 return v8::Handle<v8::Value>(); | 361 return v8::Local<v8::Value>(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 NodeOrNodeList NativeValueTraits<NodeOrNodeList>::nativeValue(const v8::Handle<v
8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | 364 NodeOrNodeList NativeValueTraits<NodeOrNodeList>::nativeValue(const v8::Local<v8
::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| 365 { | 365 { |
| 366 NodeOrNodeList impl; | 366 NodeOrNodeList impl; |
| 367 V8NodeOrNodeList::toImpl(isolate, value, impl, exceptionState); | 367 V8NodeOrNodeList::toImpl(isolate, value, impl, exceptionState); |
| 368 return impl; | 368 return impl; |
| 369 } | 369 } |
| 370 | 370 |
| 371 StringOrArrayBufferOrArrayBufferView::StringOrArrayBufferOrArrayBufferView() | 371 StringOrArrayBufferOrArrayBufferView::StringOrArrayBufferOrArrayBufferView() |
| 372 : m_type(SpecificTypeNone) | 372 : m_type(SpecificTypeNone) |
| 373 { | 373 { |
| 374 } | 374 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 405 return m_arrayBufferView; | 405 return m_arrayBufferView; |
| 406 } | 406 } |
| 407 | 407 |
| 408 void StringOrArrayBufferOrArrayBufferView::setArrayBufferView(PassRefPtr<TestArr
ayBufferView> value) | 408 void StringOrArrayBufferOrArrayBufferView::setArrayBufferView(PassRefPtr<TestArr
ayBufferView> value) |
| 409 { | 409 { |
| 410 ASSERT(isNull()); | 410 ASSERT(isNull()); |
| 411 m_arrayBufferView = value; | 411 m_arrayBufferView = value; |
| 412 m_type = SpecificTypeArrayBufferView; | 412 m_type = SpecificTypeArrayBufferView; |
| 413 } | 413 } |
| 414 | 414 |
| 415 void V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Ha
ndle<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, ExceptionSt
ate& exceptionState) | 415 void V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Lo
cal<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, ExceptionSta
te& exceptionState) |
| 416 { | 416 { |
| 417 if (v8Value.IsEmpty()) | 417 if (v8Value.IsEmpty()) |
| 418 return; | 418 return; |
| 419 | 419 |
| 420 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { | 420 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { |
| 421 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Handle<v8::
Object>::Cast(v8Value)); | 421 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O
bject>::Cast(v8Value)); |
| 422 impl.setArrayBuffer(cppValue); | 422 impl.setArrayBuffer(cppValue); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 | 425 |
| 426 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { | 426 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { |
| 427 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Han
dle<v8::Object>::Cast(v8Value)); | 427 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc
al<v8::Object>::Cast(v8Value)); |
| 428 impl.setArrayBufferView(cppValue); | 428 impl.setArrayBufferView(cppValue); |
| 429 return; | 429 return; |
| 430 } | 430 } |
| 431 | 431 |
| 432 { | 432 { |
| 433 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); | 433 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); |
| 434 impl.setString(cppValue); | 434 impl.setString(cppValue); |
| 435 return; | 435 return; |
| 436 } | 436 } |
| 437 | 437 |
| 438 } | 438 } |
| 439 | 439 |
| 440 v8::Handle<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) | 440 v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& impl, v8::
Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 441 { | 441 { |
| 442 switch (impl.m_type) { | 442 switch (impl.m_type) { |
| 443 case StringOrArrayBufferOrArrayBufferView::SpecificTypeNone: | 443 case StringOrArrayBufferOrArrayBufferView::SpecificTypeNone: |
| 444 return v8::Null(isolate); | 444 return v8::Null(isolate); |
| 445 case StringOrArrayBufferOrArrayBufferView::SpecificTypeString: | 445 case StringOrArrayBufferOrArrayBufferView::SpecificTypeString: |
| 446 return v8String(isolate, impl.getAsString()); | 446 return v8String(isolate, impl.getAsString()); |
| 447 case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBuffer: | 447 case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBuffer: |
| 448 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); | 448 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); |
| 449 case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBufferView: | 449 case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBufferView: |
| 450 return toV8(impl.getAsArrayBufferView(), creationContext, isolate); | 450 return toV8(impl.getAsArrayBufferView(), creationContext, isolate); |
| 451 default: | 451 default: |
| 452 ASSERT_NOT_REACHED(); | 452 ASSERT_NOT_REACHED(); |
| 453 } | 453 } |
| 454 return v8::Handle<v8::Value>(); | 454 return v8::Local<v8::Value>(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 StringOrArrayBufferOrArrayBufferView NativeValueTraits<StringOrArrayBufferOrArra
yBufferView>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isola
te, ExceptionState& exceptionState) | 457 StringOrArrayBufferOrArrayBufferView NativeValueTraits<StringOrArrayBufferOrArra
yBufferView>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolat
e, ExceptionState& exceptionState) |
| 458 { | 458 { |
| 459 StringOrArrayBufferOrArrayBufferView impl; | 459 StringOrArrayBufferOrArrayBufferView impl; |
| 460 V8StringOrArrayBufferOrArrayBufferView::toImpl(isolate, value, impl, excepti
onState); | 460 V8StringOrArrayBufferOrArrayBufferView::toImpl(isolate, value, impl, excepti
onState); |
| 461 return impl; | 461 return impl; |
| 462 } | 462 } |
| 463 | 463 |
| 464 StringOrDouble::StringOrDouble() | 464 StringOrDouble::StringOrDouble() |
| 465 : m_type(SpecificTypeNone) | 465 : m_type(SpecificTypeNone) |
| 466 { | 466 { |
| 467 } | 467 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 485 return m_double; | 485 return m_double; |
| 486 } | 486 } |
| 487 | 487 |
| 488 void StringOrDouble::setDouble(double value) | 488 void StringOrDouble::setDouble(double value) |
| 489 { | 489 { |
| 490 ASSERT(isNull()); | 490 ASSERT(isNull()); |
| 491 m_double = value; | 491 m_double = value; |
| 492 m_type = SpecificTypeDouble; | 492 m_type = SpecificTypeDouble; |
| 493 } | 493 } |
| 494 | 494 |
| 495 void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Valu
e, StringOrDouble& impl, ExceptionState& exceptionState) | 495 void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value
, StringOrDouble& impl, ExceptionState& exceptionState) |
| 496 { | 496 { |
| 497 if (v8Value.IsEmpty()) | 497 if (v8Value.IsEmpty()) |
| 498 return; | 498 return; |
| 499 | 499 |
| 500 if (v8Value->IsNumber()) { | 500 if (v8Value->IsNumber()) { |
| 501 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); | 501 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti
onState), exceptionState); |
| 502 impl.setDouble(cppValue); | 502 impl.setDouble(cppValue); |
| 503 return; | 503 return; |
| 504 } | 504 } |
| 505 | 505 |
| 506 { | 506 { |
| 507 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); | 507 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); |
| 508 impl.setString(cppValue); | 508 impl.setString(cppValue); |
| 509 return; | 509 return; |
| 510 } | 510 } |
| 511 | 511 |
| 512 } | 512 } |
| 513 | 513 |
| 514 v8::Handle<v8::Value> toV8(const StringOrDouble& impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 514 v8::Local<v8::Value> toV8(const StringOrDouble& impl, v8::Local<v8::Object> crea
tionContext, v8::Isolate* isolate) |
| 515 { | 515 { |
| 516 switch (impl.m_type) { | 516 switch (impl.m_type) { |
| 517 case StringOrDouble::SpecificTypeNone: | 517 case StringOrDouble::SpecificTypeNone: |
| 518 return v8::Null(isolate); | 518 return v8::Null(isolate); |
| 519 case StringOrDouble::SpecificTypeString: | 519 case StringOrDouble::SpecificTypeString: |
| 520 return v8String(isolate, impl.getAsString()); | 520 return v8String(isolate, impl.getAsString()); |
| 521 case StringOrDouble::SpecificTypeDouble: | 521 case StringOrDouble::SpecificTypeDouble: |
| 522 return v8::Number::New(isolate, impl.getAsDouble()); | 522 return v8::Number::New(isolate, impl.getAsDouble()); |
| 523 default: | 523 default: |
| 524 ASSERT_NOT_REACHED(); | 524 ASSERT_NOT_REACHED(); |
| 525 } | 525 } |
| 526 return v8::Handle<v8::Value>(); | 526 return v8::Local<v8::Value>(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 StringOrDouble NativeValueTraits<StringOrDouble>::nativeValue(const v8::Handle<v
8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | 529 StringOrDouble NativeValueTraits<StringOrDouble>::nativeValue(const v8::Local<v8
::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| 530 { | 530 { |
| 531 StringOrDouble impl; | 531 StringOrDouble impl; |
| 532 V8StringOrDouble::toImpl(isolate, value, impl, exceptionState); | 532 V8StringOrDouble::toImpl(isolate, value, impl, exceptionState); |
| 533 return impl; | 533 return impl; |
| 534 } | 534 } |
| 535 | 535 |
| 536 TestInterface2OrUint8Array::TestInterface2OrUint8Array() | 536 TestInterface2OrUint8Array::TestInterface2OrUint8Array() |
| 537 : m_type(SpecificTypeNone) | 537 : m_type(SpecificTypeNone) |
| 538 { | 538 { |
| 539 } | 539 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 557 return m_uint8Array; | 557 return m_uint8Array; |
| 558 } | 558 } |
| 559 | 559 |
| 560 void TestInterface2OrUint8Array::setUint8Array(PassRefPtr<DOMUint8Array> value) | 560 void TestInterface2OrUint8Array::setUint8Array(PassRefPtr<DOMUint8Array> value) |
| 561 { | 561 { |
| 562 ASSERT(isNull()); | 562 ASSERT(isNull()); |
| 563 m_uint8Array = value; | 563 m_uint8Array = value; |
| 564 m_type = SpecificTypeUint8Array; | 564 m_type = SpecificTypeUint8Array; |
| 565 } | 565 } |
| 566 | 566 |
| 567 void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Handle<v8::V
alue> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState) | 567 void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Va
lue> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState) |
| 568 { | 568 { |
| 569 if (v8Value.IsEmpty()) | 569 if (v8Value.IsEmpty()) |
| 570 return; | 570 return; |
| 571 | 571 |
| 572 if (V8TestInterface2::hasInstance(v8Value, isolate)) { | 572 if (V8TestInterface2::hasInstance(v8Value, isolate)) { |
| 573 RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Handle<v8
::Object>::Cast(v8Value)); | 573 RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Local<v8:
:Object>::Cast(v8Value)); |
| 574 impl.setTestInterface2(cppValue); | 574 impl.setTestInterface2(cppValue); |
| 575 return; | 575 return; |
| 576 } | 576 } |
| 577 | 577 |
| 578 if (V8Uint8Array::hasInstance(v8Value, isolate)) { | 578 if (V8Uint8Array::hasInstance(v8Value, isolate)) { |
| 579 RefPtr<DOMUint8Array> cppValue = V8Uint8Array::toImpl(v8::Handle<v8::Obj
ect>::Cast(v8Value)); | 579 RefPtr<DOMUint8Array> cppValue = V8Uint8Array::toImpl(v8::Local<v8::Obje
ct>::Cast(v8Value)); |
| 580 impl.setUint8Array(cppValue); | 580 impl.setUint8Array(cppValue); |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 | 583 |
| 584 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face2 or Uint8Array)'"); | 584 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face2 or Uint8Array)'"); |
| 585 } | 585 } |
| 586 | 586 |
| 587 v8::Handle<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 587 v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Local<v8::
Object> creationContext, v8::Isolate* isolate) |
| 588 { | 588 { |
| 589 switch (impl.m_type) { | 589 switch (impl.m_type) { |
| 590 case TestInterface2OrUint8Array::SpecificTypeNone: | 590 case TestInterface2OrUint8Array::SpecificTypeNone: |
| 591 return v8::Null(isolate); | 591 return v8::Null(isolate); |
| 592 case TestInterface2OrUint8Array::SpecificTypeTestInterface2: | 592 case TestInterface2OrUint8Array::SpecificTypeTestInterface2: |
| 593 return toV8(impl.getAsTestInterface2(), creationContext, isolate); | 593 return toV8(impl.getAsTestInterface2(), creationContext, isolate); |
| 594 case TestInterface2OrUint8Array::SpecificTypeUint8Array: | 594 case TestInterface2OrUint8Array::SpecificTypeUint8Array: |
| 595 return toV8(impl.getAsUint8Array(), creationContext, isolate); | 595 return toV8(impl.getAsUint8Array(), creationContext, isolate); |
| 596 default: | 596 default: |
| 597 ASSERT_NOT_REACHED(); | 597 ASSERT_NOT_REACHED(); |
| 598 } | 598 } |
| 599 return v8::Handle<v8::Value>(); | 599 return v8::Local<v8::Value>(); |
| 600 } | 600 } |
| 601 | 601 |
| 602 TestInterface2OrUint8Array NativeValueTraits<TestInterface2OrUint8Array>::native
Value(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState&
exceptionState) | 602 TestInterface2OrUint8Array NativeValueTraits<TestInterface2OrUint8Array>::native
Value(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& e
xceptionState) |
| 603 { | 603 { |
| 604 TestInterface2OrUint8Array impl; | 604 TestInterface2OrUint8Array impl; |
| 605 V8TestInterface2OrUint8Array::toImpl(isolate, value, impl, exceptionState); | 605 V8TestInterface2OrUint8Array::toImpl(isolate, value, impl, exceptionState); |
| 606 return impl; | 606 return impl; |
| 607 } | 607 } |
| 608 | 608 |
| 609 TestInterfaceGarbageCollectedOrString::TestInterfaceGarbageCollectedOrString() | 609 TestInterfaceGarbageCollectedOrString::TestInterfaceGarbageCollectedOrString() |
| 610 : m_type(SpecificTypeNone) | 610 : m_type(SpecificTypeNone) |
| 611 { | 611 { |
| 612 } | 612 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 635 ASSERT(isNull()); | 635 ASSERT(isNull()); |
| 636 m_string = value; | 636 m_string = value; |
| 637 m_type = SpecificTypeString; | 637 m_type = SpecificTypeString; |
| 638 } | 638 } |
| 639 | 639 |
| 640 void TestInterfaceGarbageCollectedOrString::trace(Visitor* visitor) | 640 void TestInterfaceGarbageCollectedOrString::trace(Visitor* visitor) |
| 641 { | 641 { |
| 642 visitor->trace(m_testInterfaceGarbageCollected); | 642 visitor->trace(m_testInterfaceGarbageCollected); |
| 643 } | 643 } |
| 644 | 644 |
| 645 void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::H
andle<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, Exception
State& exceptionState) | 645 void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::L
ocal<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, ExceptionS
tate& exceptionState) |
| 646 { | 646 { |
| 647 if (v8Value.IsEmpty()) | 647 if (v8Value.IsEmpty()) |
| 648 return; | 648 return; |
| 649 | 649 |
| 650 if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) { | 650 if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) { |
| 651 RawPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageC
ollected::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); | 651 RawPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageC
ollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); |
| 652 impl.setTestInterfaceGarbageCollected(cppValue); | 652 impl.setTestInterfaceGarbageCollected(cppValue); |
| 653 return; | 653 return; |
| 654 } | 654 } |
| 655 | 655 |
| 656 { | 656 { |
| 657 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); | 657 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce
ptionState); |
| 658 impl.setString(cppValue); | 658 impl.setString(cppValue); |
| 659 return; | 659 return; |
| 660 } | 660 } |
| 661 | 661 |
| 662 } | 662 } |
| 663 | 663 |
| 664 v8::Handle<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString& impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 664 v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString& impl, v8:
:Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 665 { | 665 { |
| 666 switch (impl.m_type) { | 666 switch (impl.m_type) { |
| 667 case TestInterfaceGarbageCollectedOrString::SpecificTypeNone: | 667 case TestInterfaceGarbageCollectedOrString::SpecificTypeNone: |
| 668 return v8::Null(isolate); | 668 return v8::Null(isolate); |
| 669 case TestInterfaceGarbageCollectedOrString::SpecificTypeTestInterfaceGarbage
Collected: | 669 case TestInterfaceGarbageCollectedOrString::SpecificTypeTestInterfaceGarbage
Collected: |
| 670 return toV8(impl.getAsTestInterfaceGarbageCollected(), creationContext,
isolate); | 670 return toV8(impl.getAsTestInterfaceGarbageCollected(), creationContext,
isolate); |
| 671 case TestInterfaceGarbageCollectedOrString::SpecificTypeString: | 671 case TestInterfaceGarbageCollectedOrString::SpecificTypeString: |
| 672 return v8String(isolate, impl.getAsString()); | 672 return v8String(isolate, impl.getAsString()); |
| 673 default: | 673 default: |
| 674 ASSERT_NOT_REACHED(); | 674 ASSERT_NOT_REACHED(); |
| 675 } | 675 } |
| 676 return v8::Handle<v8::Value>(); | 676 return v8::Local<v8::Value>(); |
| 677 } | 677 } |
| 678 | 678 |
| 679 TestInterfaceGarbageCollectedOrString NativeValueTraits<TestInterfaceGarbageColl
ectedOrString>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* iso
late, ExceptionState& exceptionState) | 679 TestInterfaceGarbageCollectedOrString NativeValueTraits<TestInterfaceGarbageColl
ectedOrString>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isol
ate, ExceptionState& exceptionState) |
| 680 { | 680 { |
| 681 TestInterfaceGarbageCollectedOrString impl; | 681 TestInterfaceGarbageCollectedOrString impl; |
| 682 V8TestInterfaceGarbageCollectedOrString::toImpl(isolate, value, impl, except
ionState); | 682 V8TestInterfaceGarbageCollectedOrString::toImpl(isolate, value, impl, except
ionState); |
| 683 return impl; | 683 return impl; |
| 684 } | 684 } |
| 685 | 685 |
| 686 TestInterfaceOrLong::TestInterfaceOrLong() | 686 TestInterfaceOrLong::TestInterfaceOrLong() |
| 687 : m_type(SpecificTypeNone) | 687 : m_type(SpecificTypeNone) |
| 688 { | 688 { |
| 689 } | 689 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 707 return m_long; | 707 return m_long; |
| 708 } | 708 } |
| 709 | 709 |
| 710 void TestInterfaceOrLong::setLong(int value) | 710 void TestInterfaceOrLong::setLong(int value) |
| 711 { | 711 { |
| 712 ASSERT(isNull()); | 712 ASSERT(isNull()); |
| 713 m_long = value; | 713 m_long = value; |
| 714 m_type = SpecificTypeLong; | 714 m_type = SpecificTypeLong; |
| 715 } | 715 } |
| 716 | 716 |
| 717 void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v
8Value, TestInterfaceOrLong& impl, ExceptionState& exceptionState) | 717 void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8
Value, TestInterfaceOrLong& impl, ExceptionState& exceptionState) |
| 718 { | 718 { |
| 719 if (v8Value.IsEmpty()) | 719 if (v8Value.IsEmpty()) |
| 720 return; | 720 return; |
| 721 | 721 |
| 722 if (V8TestInterface::hasInstance(v8Value, isolate)) { | 722 if (V8TestInterface::hasInstance(v8Value, isolate)) { |
| 723 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v
8::Handle<v8::Object>::Cast(v8Value)); | 723 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v
8::Local<v8::Object>::Cast(v8Value)); |
| 724 impl.setTestInterface(cppValue); | 724 impl.setTestInterface(cppValue); |
| 725 return; | 725 return; |
| 726 } | 726 } |
| 727 | 727 |
| 728 if (v8Value->IsNumber()) { | 728 if (v8Value->IsNumber()) { |
| 729 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt
ate), exceptionState); | 729 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt
ate), exceptionState); |
| 730 impl.setLong(cppValue); | 730 impl.setLong(cppValue); |
| 731 return; | 731 return; |
| 732 } | 732 } |
| 733 | 733 |
| 734 { | 734 { |
| 735 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt
ate), exceptionState); | 735 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt
ate), exceptionState); |
| 736 impl.setLong(cppValue); | 736 impl.setLong(cppValue); |
| 737 return; | 737 return; |
| 738 } | 738 } |
| 739 | 739 |
| 740 } | 740 } |
| 741 | 741 |
| 742 v8::Handle<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) | 742 v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object>
creationContext, v8::Isolate* isolate) |
| 743 { | 743 { |
| 744 switch (impl.m_type) { | 744 switch (impl.m_type) { |
| 745 case TestInterfaceOrLong::SpecificTypeNone: | 745 case TestInterfaceOrLong::SpecificTypeNone: |
| 746 return v8::Null(isolate); | 746 return v8::Null(isolate); |
| 747 case TestInterfaceOrLong::SpecificTypeTestInterface: | 747 case TestInterfaceOrLong::SpecificTypeTestInterface: |
| 748 return toV8(impl.getAsTestInterface(), creationContext, isolate); | 748 return toV8(impl.getAsTestInterface(), creationContext, isolate); |
| 749 case TestInterfaceOrLong::SpecificTypeLong: | 749 case TestInterfaceOrLong::SpecificTypeLong: |
| 750 return v8::Integer::New(isolate, impl.getAsLong()); | 750 return v8::Integer::New(isolate, impl.getAsLong()); |
| 751 default: | 751 default: |
| 752 ASSERT_NOT_REACHED(); | 752 ASSERT_NOT_REACHED(); |
| 753 } | 753 } |
| 754 return v8::Handle<v8::Value>(); | 754 return v8::Local<v8::Value>(); |
| 755 } | 755 } |
| 756 | 756 |
| 757 TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(const v8
::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState
) | 757 TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(const v8
::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| 758 { | 758 { |
| 759 TestInterfaceOrLong impl; | 759 TestInterfaceOrLong impl; |
| 760 V8TestInterfaceOrLong::toImpl(isolate, value, impl, exceptionState); | 760 V8TestInterfaceOrLong::toImpl(isolate, value, impl, exceptionState); |
| 761 return impl; | 761 return impl; |
| 762 } | 762 } |
| 763 | 763 |
| 764 TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty() | 764 TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty() |
| 765 : m_type(SpecificTypeNone) | 765 : m_type(SpecificTypeNone) |
| 766 { | 766 { |
| 767 } | 767 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 785 return m_testInterfaceEmpty; | 785 return m_testInterfaceEmpty; |
| 786 } | 786 } |
| 787 | 787 |
| 788 void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(PassRefPtr<TestInt
erfaceEmpty> value) | 788 void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(PassRefPtr<TestInt
erfaceEmpty> value) |
| 789 { | 789 { |
| 790 ASSERT(isNull()); | 790 ASSERT(isNull()); |
| 791 m_testInterfaceEmpty = value; | 791 m_testInterfaceEmpty = value; |
| 792 m_type = SpecificTypeTestInterfaceEmpty; | 792 m_type = SpecificTypeTestInterfaceEmpty; |
| 793 } | 793 } |
| 794 | 794 |
| 795 void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Handl
e<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& e
xceptionState) | 795 void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local
<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& ex
ceptionState) |
| 796 { | 796 { |
| 797 if (v8Value.IsEmpty()) | 797 if (v8Value.IsEmpty()) |
| 798 return; | 798 return; |
| 799 | 799 |
| 800 if (V8TestInterface::hasInstance(v8Value, isolate)) { | 800 if (V8TestInterface::hasInstance(v8Value, isolate)) { |
| 801 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v
8::Handle<v8::Object>::Cast(v8Value)); | 801 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v
8::Local<v8::Object>::Cast(v8Value)); |
| 802 impl.setTestInterface(cppValue); | 802 impl.setTestInterface(cppValue); |
| 803 return; | 803 return; |
| 804 } | 804 } |
| 805 | 805 |
| 806 if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { | 806 if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { |
| 807 RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImpl(v8::H
andle<v8::Object>::Cast(v8Value)); | 807 RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImpl(v8::L
ocal<v8::Object>::Cast(v8Value)); |
| 808 impl.setTestInterfaceEmpty(cppValue); | 808 impl.setTestInterfaceEmpty(cppValue); |
| 809 return; | 809 return; |
| 810 } | 810 } |
| 811 | 811 |
| 812 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face or TestInterfaceEmpty)'"); | 812 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face or TestInterfaceEmpty)'"); |
| 813 } | 813 } |
| 814 | 814 |
| 815 v8::Handle<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate* isolate) | 815 v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Loc
al<v8::Object> creationContext, v8::Isolate* isolate) |
| 816 { | 816 { |
| 817 switch (impl.m_type) { | 817 switch (impl.m_type) { |
| 818 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone: | 818 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone: |
| 819 return v8::Null(isolate); | 819 return v8::Null(isolate); |
| 820 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface: | 820 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface: |
| 821 return toV8(impl.getAsTestInterface(), creationContext, isolate); | 821 return toV8(impl.getAsTestInterface(), creationContext, isolate); |
| 822 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty: | 822 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty: |
| 823 return toV8(impl.getAsTestInterfaceEmpty(), creationContext, isolate); | 823 return toV8(impl.getAsTestInterfaceEmpty(), creationContext, isolate); |
| 824 default: | 824 default: |
| 825 ASSERT_NOT_REACHED(); | 825 ASSERT_NOT_REACHED(); |
| 826 } | 826 } |
| 827 return v8::Handle<v8::Value>(); | 827 return v8::Local<v8::Value>(); |
| 828 } | 828 } |
| 829 | 829 |
| 830 TestInterfaceOrTestInterfaceEmpty NativeValueTraits<TestInterfaceOrTestInterface
Empty>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, Ex
ceptionState& exceptionState) | 830 TestInterfaceOrTestInterfaceEmpty NativeValueTraits<TestInterfaceOrTestInterface
Empty>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, Exc
eptionState& exceptionState) |
| 831 { | 831 { |
| 832 TestInterfaceOrTestInterfaceEmpty impl; | 832 TestInterfaceOrTestInterfaceEmpty impl; |
| 833 V8TestInterfaceOrTestInterfaceEmpty::toImpl(isolate, value, impl, exceptionS
tate); | 833 V8TestInterfaceOrTestInterfaceEmpty::toImpl(isolate, value, impl, exceptionS
tate); |
| 834 return impl; | 834 return impl; |
| 835 } | 835 } |
| 836 | 836 |
| 837 TestInterfaceWillBeGarbageCollectedOrTestDictionary::TestInterfaceWillBeGarbageC
ollectedOrTestDictionary() | 837 TestInterfaceWillBeGarbageCollectedOrTestDictionary::TestInterfaceWillBeGarbageC
ollectedOrTestDictionary() |
| 838 : m_type(SpecificTypeNone) | 838 : m_type(SpecificTypeNone) |
| 839 { | 839 { |
| 840 } | 840 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 864 m_testDictionary = value; | 864 m_testDictionary = value; |
| 865 m_type = SpecificTypeTestDictionary; | 865 m_type = SpecificTypeTestDictionary; |
| 866 } | 866 } |
| 867 | 867 |
| 868 void TestInterfaceWillBeGarbageCollectedOrTestDictionary::trace(Visitor* visitor
) | 868 void TestInterfaceWillBeGarbageCollectedOrTestDictionary::trace(Visitor* visitor
) |
| 869 { | 869 { |
| 870 visitor->trace(m_testInterfaceWillBeGarbageCollected); | 870 visitor->trace(m_testInterfaceWillBeGarbageCollected); |
| 871 visitor->trace(m_testDictionary); | 871 visitor->trace(m_testDictionary); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate*
isolate, v8::Handle<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTes
tDictionary& impl, ExceptionState& exceptionState) | 874 void V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate*
isolate, v8::Local<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTest
Dictionary& impl, ExceptionState& exceptionState) |
| 875 { | 875 { |
| 876 if (v8Value.IsEmpty()) | 876 if (v8Value.IsEmpty()) |
| 877 return; | 877 return; |
| 878 | 878 |
| 879 if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) { | 879 if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) { |
| 880 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8Tes
tInterfaceWillBeGarbageCollected::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); | 880 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8Tes
tInterfaceWillBeGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); |
| 881 impl.setTestInterfaceWillBeGarbageCollected(cppValue); | 881 impl.setTestInterfaceWillBeGarbageCollected(cppValue); |
| 882 return; | 882 return; |
| 883 } | 883 } |
| 884 | 884 |
| 885 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { | 885 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
| 886 TestDictionary cppValue; | 886 TestDictionary cppValue; |
| 887 TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8TestDictionary::toImpl(isolat
e, v8Value, cppValue, exceptionState), exceptionState); | 887 TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8TestDictionary::toImpl(isolat
e, v8Value, cppValue, exceptionState), exceptionState); |
| 888 impl.setTestDictionary(cppValue); | 888 impl.setTestDictionary(cppValue); |
| 889 return; | 889 return; |
| 890 } | 890 } |
| 891 | 891 |
| 892 exceptionState.throwTypeError("The provided value is not of type '(TestInter
faceWillBeGarbageCollected or TestDictionary)'"); | 892 exceptionState.throwTypeError("The provided value is not of type '(TestInter
faceWillBeGarbageCollected or TestDictionary)'"); |
| 893 } | 893 } |
| 894 | 894 |
| 895 v8::Handle<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDictio
nary& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 895 v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDiction
ary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 896 { | 896 { |
| 897 switch (impl.m_type) { | 897 switch (impl.m_type) { |
| 898 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeNone: | 898 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeNone: |
| 899 return v8::Null(isolate); | 899 return v8::Null(isolate); |
| 900 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestIn
terfaceWillBeGarbageCollected: | 900 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestIn
terfaceWillBeGarbageCollected: |
| 901 return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationCon
text, isolate); | 901 return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationCon
text, isolate); |
| 902 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestDi
ctionary: | 902 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestDi
ctionary: |
| 903 return toV8(impl.getAsTestDictionary(), creationContext, isolate); | 903 return toV8(impl.getAsTestDictionary(), creationContext, isolate); |
| 904 default: | 904 default: |
| 905 ASSERT_NOT_REACHED(); | 905 ASSERT_NOT_REACHED(); |
| 906 } | 906 } |
| 907 return v8::Handle<v8::Value>(); | 907 return v8::Local<v8::Value>(); |
| 908 } | 908 } |
| 909 | 909 |
| 910 TestInterfaceWillBeGarbageCollectedOrTestDictionary NativeValueTraits<TestInterf
aceWillBeGarbageCollectedOrTestDictionary>::nativeValue(const v8::Handle<v8::Val
ue>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | 910 TestInterfaceWillBeGarbageCollectedOrTestDictionary NativeValueTraits<TestInterf
aceWillBeGarbageCollectedOrTestDictionary>::nativeValue(const v8::Local<v8::Valu
e>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| 911 { | 911 { |
| 912 TestInterfaceWillBeGarbageCollectedOrTestDictionary impl; | 912 TestInterfaceWillBeGarbageCollectedOrTestDictionary impl; |
| 913 V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(isolate, value
, impl, exceptionState); | 913 V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(isolate, value
, impl, exceptionState); |
| 914 return impl; | 914 return impl; |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace blink | 917 } // namespace blink |
| OLD | NEW |