| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "bindings/core/v8/ArrayValue.h" | 28 #include "bindings/core/v8/ArrayValue.h" |
| 29 #include "bindings/core/v8/DictionaryHelperForBindings.h" | 29 #include "bindings/core/v8/DictionaryHelperForBindings.h" |
| 30 #include "bindings/core/v8/ExceptionMessages.h" | 30 #include "bindings/core/v8/ExceptionMessages.h" |
| 31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
| 32 #include "bindings/core/v8/V8Binding.h" | 32 #include "bindings/core/v8/V8Binding.h" |
| 33 #include "bindings/core/v8/V8DOMError.h" | 33 #include "bindings/core/v8/V8DOMError.h" |
| 34 #include "bindings/core/v8/V8Element.h" | 34 #include "bindings/core/v8/V8Element.h" |
| 35 #include "bindings/core/v8/V8EventTarget.h" | 35 #include "bindings/core/v8/V8EventTarget.h" |
| 36 #include "bindings/core/v8/V8MediaKeyError.h" | 36 #include "bindings/core/v8/V8MediaKeyError.h" |
| 37 #include "bindings/core/v8/V8MessagePort.h" | |
| 38 #include "bindings/core/v8/V8Path2D.h" | 37 #include "bindings/core/v8/V8Path2D.h" |
| 39 #include "bindings/core/v8/V8VoidCallback.h" | 38 #include "bindings/core/v8/V8VoidCallback.h" |
| 40 #include "bindings/core/v8/V8Window.h" | 39 #include "bindings/core/v8/V8Window.h" |
| 41 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" | 40 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" |
| 42 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" | 41 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" |
| 43 #include "wtf/MathExtras.h" | 42 #include "wtf/MathExtras.h" |
| 44 | 43 |
| 45 namespace blink { | 44 namespace blink { |
| 46 | 45 |
| 47 template <> | 46 template <> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if (!dictionary.get(key, v8Value)) | 254 if (!dictionary.get(key, v8Value)) |
| 256 return false; | 255 return false; |
| 257 | 256 |
| 258 // We need to handle a DOMWindow specially, because a DOMWindow wrapper | 257 // We need to handle a DOMWindow specially, because a DOMWindow wrapper |
| 259 // exists on a prototype chain of v8Value. | 258 // exists on a prototype chain of v8Value. |
| 260 value = toDOMWindow(v8Value, dictionary.isolate()); | 259 value = toDOMWindow(v8Value, dictionary.isolate()); |
| 261 return true; | 260 return true; |
| 262 } | 261 } |
| 263 | 262 |
| 264 template <> | 263 template <> |
| 265 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess
agePortArray& value) | |
| 266 { | |
| 267 v8::Local<v8::Value> v8Value; | |
| 268 if (!dictionary.get(key, v8Value)) | |
| 269 return false; | |
| 270 | |
| 271 ASSERT(dictionary.isolate()); | |
| 272 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); | |
| 273 if (blink::isUndefinedOrNull(v8Value)) | |
| 274 return true; | |
| 275 bool success = false; | |
| 276 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value,
key, dictionary.isolate(), &success); | |
| 277 return success; | |
| 278 } | |
| 279 | |
| 280 template <> | |
| 281 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash
Set<AtomicString>& value) | 264 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash
Set<AtomicString>& value) |
| 282 { | 265 { |
| 283 v8::Local<v8::Value> v8Value; | 266 v8::Local<v8::Value> v8Value; |
| 284 if (!dictionary.get(key, v8Value)) | 267 if (!dictionary.get(key, v8Value)) |
| 285 return false; | 268 return false; |
| 286 | 269 |
| 287 // FIXME: Support array-like objects | 270 // FIXME: Support array-like objects |
| 288 if (!v8Value->IsArray()) | 271 if (!v8Value->IsArray()) |
| 289 return false; | 272 return false; |
| 290 | 273 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long>& value); | 584 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long>& value); |
| 602 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long long>& value); | 585 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long long>& value); |
| 603 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long long>& value); | 586 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long long>& value); |
| 604 | 587 |
| 605 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); | 588 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); |
| 606 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<Uint8Array>& value); | 589 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<Uint8Array>& value); |
| 607 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<ArrayBufferView>& value); | 590 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<ArrayBufferView>& value); |
| 608 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); | 591 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); |
| 609 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); | 592 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); |
| 610 | 593 |
| 611 template <> | |
| 612 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers
ionContext& context, const String& key, MessagePortArray& value) | |
| 613 { | |
| 614 Dictionary::ConversionContextScope scope(context); | |
| 615 | |
| 616 v8::Local<v8::Value> v8Value; | |
| 617 if (!dictionary.get(key, v8Value)) | |
| 618 return true; | |
| 619 | |
| 620 return DictionaryHelper::get(dictionary, key, value); | |
| 621 } | |
| 622 | |
| 623 } // namespace blink | 594 } // namespace blink |
| OLD | NEW |