Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

Issue 1006323002: [bindings] Pass v8::Local<v8::Value> by value in NativeValueTraits<T>::nativeValue() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 exceptionState.rethrowV8Exception(block.Exception()); 834 exceptionState.rethrowV8Exception(block.Exception());
835 return false; 835 return false;
836 } 836 }
837 837
838 length = sequenceLength; 838 length = sequenceLength;
839 return true; 839 return true;
840 } 840 }
841 841
842 template<> 842 template<>
843 struct NativeValueTraits<String> { 843 struct NativeValueTraits<String> {
844 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState) 844 static inline String nativeValue(v8::Local<v8::Value> value, v8::Isolate* is olate, ExceptionState& exceptionState)
845 { 845 {
846 V8StringResource<> stringValue(value); 846 V8StringResource<> stringValue(value);
847 if (!stringValue.prepare(exceptionState)) 847 if (!stringValue.prepare(exceptionState))
848 return String(); 848 return String();
849 return stringValue; 849 return stringValue;
850 } 850 }
851 }; 851 };
852 852
853 template<> 853 template<>
854 struct NativeValueTraits<int> { 854 struct NativeValueTraits<int> {
855 static inline int nativeValue(const v8::Local<v8::Value>& value, v8::Isolate * isolate, ExceptionState& exceptionState) 855 static inline int nativeValue(v8::Local<v8::Value> value, v8::Isolate* isola te, ExceptionState& exceptionState)
856 { 856 {
857 return toInt32(value, exceptionState); 857 return toInt32(value, exceptionState);
858 } 858 }
859 }; 859 };
860 860
861 template<> 861 template<>
862 struct NativeValueTraits<unsigned> { 862 struct NativeValueTraits<unsigned> {
863 static inline unsigned nativeValue(const v8::Local<v8::Value>& value, v8::Is olate* isolate, ExceptionState& exceptionState) 863 static inline unsigned nativeValue(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState)
864 { 864 {
865 return toUInt32(value, exceptionState); 865 return toUInt32(value, exceptionState);
866 } 866 }
867 }; 867 };
868 868
869 template<> 869 template<>
870 struct NativeValueTraits<float> { 870 struct NativeValueTraits<float> {
871 static inline float nativeValue(const v8::Local<v8::Value>& value, v8::Isola te* isolate, ExceptionState& exceptionState) 871 static inline float nativeValue(v8::Local<v8::Value> value, v8::Isolate* iso late, ExceptionState& exceptionState)
872 { 872 {
873 return toFloat(value, exceptionState); 873 return toFloat(value, exceptionState);
874 } 874 }
875 }; 875 };
876 876
877 template<> 877 template<>
878 struct NativeValueTraits<double> { 878 struct NativeValueTraits<double> {
879 static inline double nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState) 879 static inline double nativeValue(v8::Local<v8::Value> value, v8::Isolate* is olate, ExceptionState& exceptionState)
880 { 880 {
881 return toDouble(value, exceptionState); 881 return toDouble(value, exceptionState);
882 } 882 }
883 }; 883 };
884 884
885 template<> 885 template<>
886 struct NativeValueTraits<v8::Local<v8::Value>> { 886 struct NativeValueTraits<v8::Local<v8::Value>> {
887 static inline v8::Local<v8::Value> nativeValue(const v8::Local<v8::Value>& v alue, v8::Isolate* isolate, ExceptionState&) 887 static inline v8::Local<v8::Value> nativeValue(v8::Local<v8::Value> value, v 8::Isolate* isolate, ExceptionState&)
888 { 888 {
889 return value; 889 return value;
890 } 890 }
891 }; 891 };
892 892
893 template<> 893 template<>
894 struct NativeValueTraits<ScriptValue> { 894 struct NativeValueTraits<ScriptValue> {
895 static inline ScriptValue nativeValue(const v8::Local<v8::Value>& value, v8: :Isolate* isolate, ExceptionState&) 895 static inline ScriptValue nativeValue(v8::Local<v8::Value> value, v8::Isolat e* isolate, ExceptionState&)
896 { 896 {
897 return ScriptValue(ScriptState::current(isolate), value); 897 return ScriptValue(ScriptState::current(isolate), value);
898 } 898 }
899 }; 899 };
900 900
901 template <typename T> 901 template <typename T>
902 struct NativeValueTraits<Vector<T>> { 902 struct NativeValueTraits<Vector<T>> {
903 static inline Vector<T> nativeValue(const v8::Local<v8::Value>& value, v8::I solate* isolate, ExceptionState& exceptionState) 903 static inline Vector<T> nativeValue(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState)
904 { 904 {
905 return toImplArray<T>(value, 0, isolate, exceptionState); 905 return toImplArray<T>(value, 0, isolate, exceptionState);
906 } 906 }
907 }; 907 };
908 908
909 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*); 909 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*);
910 v8::Isolate* toIsolate(LocalFrame*); 910 v8::Isolate* toIsolate(LocalFrame*);
911 911
912 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>); 912 DOMWindow* toDOMWindow(v8::Isolate*, v8::Handle<v8::Value>);
913 DOMWindow* toDOMWindow(v8::Handle<v8::Context>); 913 DOMWindow* toDOMWindow(v8::Handle<v8::Context>);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 // Callback functions used by generated code. 1060 // Callback functions used by generated code.
1061 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1061 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1062 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); 1062 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&);
1063 1063
1064 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1064 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1065 1065
1066 } // namespace blink 1066 } // namespace blink
1067 1067
1068 #endif // V8Binding_h 1068 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/NativeValueTraits.h ('k') | Source/bindings/modules/v8/V8BindingForModules.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698