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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 exceptionState.rethrowV8Exception(block.Exception()); | 764 exceptionState.rethrowV8Exception(block.Exception()); |
765 return false; | 765 return false; |
766 } | 766 } |
767 | 767 |
768 length = sequenceLength; | 768 length = sequenceLength; |
769 return true; | 769 return true; |
770 } | 770 } |
771 | 771 |
772 template<> | 772 template<> |
773 struct NativeValueTraits<String> { | 773 struct NativeValueTraits<String> { |
774 static inline String nativeValue(const v8::Handle<v8::Value>& value, v8::Iso
late* isolate, ExceptionState& exceptionState) | 774 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol
ate* isolate, ExceptionState& exceptionState) |
775 { | 775 { |
776 V8StringResource<> stringValue(value); | 776 V8StringResource<> stringValue(value); |
777 if (!stringValue.prepare(exceptionState)) | 777 if (!stringValue.prepare(exceptionState)) |
778 return String(); | 778 return String(); |
779 return stringValue; | 779 return stringValue; |
780 } | 780 } |
781 }; | 781 }; |
782 | 782 |
783 template<> | 783 template<> |
784 struct NativeValueTraits<int> { | 784 struct NativeValueTraits<int> { |
785 static inline int nativeValue(const v8::Handle<v8::Value>& value, v8::Isolat
e* isolate, ExceptionState& exceptionState) | 785 static inline int nativeValue(const v8::Local<v8::Value>& value, v8::Isolate
* isolate, ExceptionState& exceptionState) |
786 { | 786 { |
787 return toInt32(value, exceptionState); | 787 return toInt32(value, exceptionState); |
788 } | 788 } |
789 }; | 789 }; |
790 | 790 |
791 template<> | 791 template<> |
792 struct NativeValueTraits<unsigned> { | 792 struct NativeValueTraits<unsigned> { |
793 static inline unsigned nativeValue(const v8::Handle<v8::Value>& value, v8::I
solate* isolate, ExceptionState& exceptionState) | 793 static inline unsigned nativeValue(const v8::Local<v8::Value>& value, v8::Is
olate* isolate, ExceptionState& exceptionState) |
794 { | 794 { |
795 return toUInt32(value, exceptionState); | 795 return toUInt32(value, exceptionState); |
796 } | 796 } |
797 }; | 797 }; |
798 | 798 |
799 template<> | 799 template<> |
800 struct NativeValueTraits<float> { | 800 struct NativeValueTraits<float> { |
801 static inline float nativeValue(const v8::Handle<v8::Value>& value, v8::Isol
ate* isolate, ExceptionState& exceptionState) | 801 static inline float nativeValue(const v8::Local<v8::Value>& value, v8::Isola
te* isolate, ExceptionState& exceptionState) |
802 { | 802 { |
803 return toFloat(value, exceptionState); | 803 return toFloat(value, exceptionState); |
804 } | 804 } |
805 }; | 805 }; |
806 | 806 |
807 template<> | 807 template<> |
808 struct NativeValueTraits<double> { | 808 struct NativeValueTraits<double> { |
809 static inline double nativeValue(const v8::Handle<v8::Value>& value, v8::Iso
late* isolate, ExceptionState& exceptionState) | 809 static inline double nativeValue(const v8::Local<v8::Value>& value, v8::Isol
ate* isolate, ExceptionState& exceptionState) |
810 { | 810 { |
811 return toDouble(value, exceptionState); | 811 return toDouble(value, exceptionState); |
812 } | 812 } |
813 }; | 813 }; |
814 | 814 |
815 template<> | 815 template<> |
816 struct NativeValueTraits<v8::Handle<v8::Value> > { | 816 struct NativeValueTraits<v8::Local<v8::Value> > { |
817 static inline v8::Handle<v8::Value> nativeValue(const v8::Handle<v8::Value>&
value, v8::Isolate* isolate, ExceptionState&) | 817 static inline v8::Local<v8::Value> nativeValue(const v8::Local<v8::Value>& v
alue, v8::Isolate* isolate, ExceptionState&) |
818 { | 818 { |
819 return value; | 819 return value; |
820 } | 820 } |
821 }; | 821 }; |
822 | 822 |
823 template<> | 823 template<> |
824 struct NativeValueTraits<ScriptValue> { | 824 struct NativeValueTraits<ScriptValue> { |
825 static inline ScriptValue nativeValue(const v8::Handle<v8::Value>& value, v8
::Isolate* isolate, ExceptionState&) | 825 static inline ScriptValue nativeValue(const v8::Local<v8::Value>& value, v8:
:Isolate* isolate, ExceptionState&) |
826 { | 826 { |
827 return ScriptValue(ScriptState::current(isolate), value); | 827 return ScriptValue(ScriptState::current(isolate), value); |
828 } | 828 } |
829 }; | 829 }; |
830 | 830 |
831 template <typename T> | 831 template <typename T> |
832 struct NativeValueTraits<Vector<T> > { | 832 struct NativeValueTraits<Vector<T> > { |
833 static inline Vector<T> nativeValue(const v8::Handle<v8::Value>& value, v8::
Isolate* isolate, ExceptionState& exceptionState) | 833 static inline Vector<T> nativeValue(const v8::Local<v8::Value>& value, v8::I
solate* isolate, ExceptionState& exceptionState) |
834 { | 834 { |
835 return toImplArray<T>(value, 0, isolate, exceptionState); | 835 return toImplArray<T>(value, 0, isolate, exceptionState); |
836 } | 836 } |
837 }; | 837 }; |
838 | 838 |
839 v8::Isolate* toIsolate(ExecutionContext*); | 839 v8::Isolate* toIsolate(ExecutionContext*); |
840 v8::Isolate* toIsolate(LocalFrame*); | 840 v8::Isolate* toIsolate(LocalFrame*); |
841 | 841 |
842 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); | 842 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); |
843 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); | 843 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 965 |
966 private: | 966 private: |
967 v8::TryCatch& m_block; | 967 v8::TryCatch& m_block; |
968 }; | 968 }; |
969 | 969 |
970 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 970 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
971 | 971 |
972 } // namespace blink | 972 } // namespace blink |
973 | 973 |
974 #endif // V8Binding_h | 974 #endif // V8Binding_h |
OLD | NEW |