OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 18 matching lines...) Expand all Loading... | |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #ifndef V8Binding_h | 32 #ifndef V8Binding_h |
33 #define V8Binding_h | 33 #define V8Binding_h |
34 | 34 |
35 #include "bindings/core/v8/DOMDataStore.h" | 35 #include "bindings/core/v8/DOMDataStore.h" |
36 #include "bindings/core/v8/DOMWrapperWorld.h" | 36 #include "bindings/core/v8/DOMWrapperWorld.h" |
37 #include "bindings/core/v8/ExceptionMessages.h" | 37 #include "bindings/core/v8/ExceptionMessages.h" |
38 #include "bindings/core/v8/ExceptionState.h" | 38 #include "bindings/core/v8/ExceptionState.h" |
39 #include "bindings/core/v8/NativeValueTraits.h" | |
39 #include "bindings/core/v8/ScriptValue.h" | 40 #include "bindings/core/v8/ScriptValue.h" |
40 #include "bindings/core/v8/ScriptWrappable.h" | 41 #include "bindings/core/v8/ScriptWrappable.h" |
41 #include "bindings/core/v8/V8BindingMacros.h" | 42 #include "bindings/core/v8/V8BindingMacros.h" |
42 #include "bindings/core/v8/V8PerIsolateData.h" | 43 #include "bindings/core/v8/V8PerIsolateData.h" |
43 #include "bindings/core/v8/V8StringResource.h" | 44 #include "bindings/core/v8/V8StringResource.h" |
44 #include "bindings/core/v8/V8ThrowException.h" | 45 #include "bindings/core/v8/V8ThrowException.h" |
45 #include "bindings/core/v8/V8ValueCache.h" | 46 #include "bindings/core/v8/V8ValueCache.h" |
46 #include "core/CoreExport.h" | 47 #include "core/CoreExport.h" |
47 #include "platform/heap/Handle.h" | 48 #include "platform/heap/Handle.h" |
48 #include "wtf/text/AtomicString.h" | 49 #include "wtf/text/AtomicString.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 inline v8::Handle<v8::Value> v8DateOrNaN(double value, v8::Isolate* isolate) | 535 inline v8::Handle<v8::Value> v8DateOrNaN(double value, v8::Isolate* isolate) |
535 { | 536 { |
536 ASSERT(isolate); | 537 ASSERT(isolate); |
537 return v8::Date::New(isolate, std::isfinite(value) ? value : std::numeric_li mits<double>::quiet_NaN()); | 538 return v8::Date::New(isolate, std::isfinite(value) ? value : std::numeric_li mits<double>::quiet_NaN()); |
538 } | 539 } |
539 | 540 |
540 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver. | 541 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver. |
541 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Handl e<v8::Object>, ScriptState*); | 542 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Handl e<v8::Object>, ScriptState*); |
542 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate*, v8::Hand le<v8::Value>); | 543 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate*, v8::Hand le<v8::Value>); |
543 | 544 |
544 template<class T> struct NativeValueTraits; | |
545 | |
546 bool toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::Isolate*, Excepti onState&); | 545 bool toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::Isolate*, Excepti onState&); |
547 | 546 |
548 // Converts a JavaScript value to an array as per the Web IDL specification: | 547 // Converts a JavaScript value to an array as per the Web IDL specification: |
549 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array | 548 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array |
550 template <class T, class V8T> | 549 template <class T, class V8T> |
551 Vector<RefPtr<T>> toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, uin t32_t length, v8::Isolate* isolate, ExceptionState& exceptionState) | 550 Vector<RefPtr<T>> toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, uin t32_t length, v8::Isolate* isolate, ExceptionState& exceptionState) |
552 { | 551 { |
553 Vector<RefPtr<T>> result; | 552 Vector<RefPtr<T>> result; |
554 result.reserveInitialCapacity(length); | 553 result.reserveInitialCapacity(length); |
555 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); | 554 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 if (block.HasCaught()) { | 807 if (block.HasCaught()) { |
809 exceptionState.rethrowV8Exception(block.Exception()); | 808 exceptionState.rethrowV8Exception(block.Exception()); |
810 return false; | 809 return false; |
811 } | 810 } |
812 | 811 |
813 length = sequenceLength; | 812 length = sequenceLength; |
814 return true; | 813 return true; |
815 } | 814 } |
816 | 815 |
817 template<> | 816 template<> |
818 struct NativeValueTraits<String> { | 817 struct NativeValueTraits<String> { |
Yuki
2015/03/16 08:03:07
Could you add a FIXME comment so that we can move
vivekg
2015/03/16 08:32:17
Yes, I will put up the followup patch.
| |
819 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState) | 818 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState) |
820 { | 819 { |
821 V8StringResource<> stringValue(value); | 820 V8StringResource<> stringValue(value); |
822 if (!stringValue.prepare(exceptionState)) | 821 if (!stringValue.prepare(exceptionState)) |
823 return String(); | 822 return String(); |
824 return stringValue; | 823 return stringValue; |
825 } | 824 } |
826 }; | 825 }; |
827 | 826 |
828 template<> | 827 template<> |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1034 | 1033 |
1035 // Callback functions used by generated code. | 1034 // Callback functions used by generated code. |
1036 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); | 1035 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); |
1037 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); | 1036 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); |
1038 | 1037 |
1039 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); | 1038 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); |
1040 | 1039 |
1041 } // namespace blink | 1040 } // namespace blink |
1042 | 1041 |
1043 #endif // V8Binding_h | 1042 #endif // V8Binding_h |
OLD | NEW |