| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 #ifndef NativeValueTraitsImpl_h | 5 #ifndef NativeValueTraitsImpl_h |
| 6 #define NativeValueTraitsImpl_h | 6 #define NativeValueTraitsImpl_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/IDLTypes.h" | 8 #include "bindings/core/v8/IDLTypes.h" |
| 9 #include "bindings/core/v8/NativeValueTraits.h" | 9 #include "bindings/core/v8/NativeValueTraits.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| 11 #include "core/CoreExport.h" | 11 #include "core/CoreExport.h" |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 // Boolean | 16 // Boolean |
| 17 template <> | 17 template <> |
| 18 struct CORE_EXPORT NativeValueTraits<IDLBoolean> | 18 struct CORE_EXPORT NativeValueTraits<IDLBoolean> |
| 19 : public NativeValueTraitsBase<IDLBoolean> { | 19 : public NativeValueTraitsBase<IDLBoolean> { |
| 20 static inline bool nativeValue(v8::Isolate* isolate, | 20 static bool nativeValue(v8::Isolate* isolate, |
| 21 v8::Local<v8::Value> value, | 21 v8::Local<v8::Value> value, |
| 22 ExceptionState& exceptionState) { | 22 ExceptionState& exceptionState) { |
| 23 return toBoolean(isolate, value, exceptionState); | 23 return toBoolean(isolate, value, exceptionState); |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Integers | 27 // Integers |
| 28 // | 28 // |
| 29 // All integer specializations offer a second nativeValue() besides the default | 29 // All integer specializations offer a second nativeValue() besides the default |
| 30 // one: it takes an IntegerConversionConfiguration argument to let callers | 30 // one: it takes an IntegerConversionConfiguration argument to let callers |
| 31 // specify how the integers should be converted. The default nativeValue() | 31 // specify how the integers should be converted. The default nativeValue() |
| 32 // overload will always use NormalConversion. | 32 // overload will always use NormalConversion. |
| 33 template <> | 33 template <> |
| 34 struct CORE_EXPORT NativeValueTraits<IDLByte> | 34 struct CORE_EXPORT NativeValueTraits<IDLByte> |
| 35 : public NativeValueTraitsBase<IDLByte> { | 35 : public NativeValueTraitsBase<IDLByte> { |
| 36 static inline int8_t nativeValue(v8::Isolate* isolate, | 36 static int8_t nativeValue(v8::Isolate* isolate, |
| 37 v8::Local<v8::Value> value, | 37 v8::Local<v8::Value> value, |
| 38 ExceptionState& exceptionState) { | 38 ExceptionState& exceptionState) { |
| 39 return nativeValue(isolate, value, exceptionState, NormalConversion); | 39 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 40 } | 40 } |
| 41 | 41 |
| 42 static inline int8_t nativeValue( | 42 static int8_t nativeValue(v8::Isolate* isolate, |
| 43 v8::Isolate* isolate, | 43 v8::Local<v8::Value> value, |
| 44 v8::Local<v8::Value> value, | 44 ExceptionState& exceptionState, |
| 45 ExceptionState& exceptionState, | 45 IntegerConversionConfiguration conversionMode) { |
| 46 IntegerConversionConfiguration conversionMode) { | |
| 47 return toInt8(isolate, value, conversionMode, exceptionState); | 46 return toInt8(isolate, value, conversionMode, exceptionState); |
| 48 } | 47 } |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 template <> | 50 template <> |
| 52 struct CORE_EXPORT NativeValueTraits<IDLOctet> | 51 struct CORE_EXPORT NativeValueTraits<IDLOctet> |
| 53 : public NativeValueTraitsBase<IDLOctet> { | 52 : public NativeValueTraitsBase<IDLOctet> { |
| 54 static inline uint8_t nativeValue(v8::Isolate* isolate, | 53 static uint8_t nativeValue(v8::Isolate* isolate, |
| 55 v8::Local<v8::Value> value, | 54 v8::Local<v8::Value> value, |
| 56 ExceptionState& exceptionState) { | 55 ExceptionState& exceptionState) { |
| 57 return nativeValue(isolate, value, exceptionState, NormalConversion); | 56 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 58 } | 57 } |
| 59 | 58 |
| 60 static inline uint8_t nativeValue( | 59 static uint8_t nativeValue(v8::Isolate* isolate, |
| 61 v8::Isolate* isolate, | 60 v8::Local<v8::Value> value, |
| 62 v8::Local<v8::Value> value, | 61 ExceptionState& exceptionState, |
| 63 ExceptionState& exceptionState, | 62 IntegerConversionConfiguration conversionMode) { |
| 64 IntegerConversionConfiguration conversionMode) { | |
| 65 return toUInt8(isolate, value, conversionMode, exceptionState); | 63 return toUInt8(isolate, value, conversionMode, exceptionState); |
| 66 } | 64 } |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 template <> | 67 template <> |
| 70 struct CORE_EXPORT NativeValueTraits<IDLShort> | 68 struct CORE_EXPORT NativeValueTraits<IDLShort> |
| 71 : public NativeValueTraitsBase<IDLShort> { | 69 : public NativeValueTraitsBase<IDLShort> { |
| 72 static inline int16_t nativeValue(v8::Isolate* isolate, | 70 static int16_t nativeValue(v8::Isolate* isolate, |
| 73 v8::Local<v8::Value> value, | 71 v8::Local<v8::Value> value, |
| 74 ExceptionState& exceptionState) { | 72 ExceptionState& exceptionState) { |
| 75 return nativeValue(isolate, value, exceptionState, NormalConversion); | 73 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 76 } | 74 } |
| 77 | 75 |
| 78 static inline int16_t nativeValue( | 76 static int16_t nativeValue(v8::Isolate* isolate, |
| 79 v8::Isolate* isolate, | 77 v8::Local<v8::Value> value, |
| 80 v8::Local<v8::Value> value, | 78 ExceptionState& exceptionState, |
| 81 ExceptionState& exceptionState, | 79 IntegerConversionConfiguration conversionMode) { |
| 82 IntegerConversionConfiguration conversionMode) { | |
| 83 return toInt16(isolate, value, conversionMode, exceptionState); | 80 return toInt16(isolate, value, conversionMode, exceptionState); |
| 84 } | 81 } |
| 85 }; | 82 }; |
| 86 | 83 |
| 87 template <> | 84 template <> |
| 88 struct CORE_EXPORT NativeValueTraits<IDLUnsignedShort> | 85 struct CORE_EXPORT NativeValueTraits<IDLUnsignedShort> |
| 89 : public NativeValueTraitsBase<IDLUnsignedShort> { | 86 : public NativeValueTraitsBase<IDLUnsignedShort> { |
| 90 static inline uint16_t nativeValue(v8::Isolate* isolate, | 87 static uint16_t nativeValue(v8::Isolate* isolate, |
| 91 v8::Local<v8::Value> value, | 88 v8::Local<v8::Value> value, |
| 92 ExceptionState& exceptionState) { | 89 ExceptionState& exceptionState) { |
| 93 return nativeValue(isolate, value, exceptionState, NormalConversion); | 90 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 94 } | 91 } |
| 95 | 92 |
| 96 static inline uint16_t nativeValue( | 93 static uint16_t nativeValue(v8::Isolate* isolate, |
| 97 v8::Isolate* isolate, | 94 v8::Local<v8::Value> value, |
| 98 v8::Local<v8::Value> value, | 95 ExceptionState& exceptionState, |
| 99 ExceptionState& exceptionState, | 96 IntegerConversionConfiguration conversionMode) { |
| 100 IntegerConversionConfiguration conversionMode) { | |
| 101 return toUInt16(isolate, value, conversionMode, exceptionState); | 97 return toUInt16(isolate, value, conversionMode, exceptionState); |
| 102 } | 98 } |
| 103 }; | 99 }; |
| 104 | 100 |
| 105 template <> | 101 template <> |
| 106 struct CORE_EXPORT NativeValueTraits<IDLLong> | 102 struct CORE_EXPORT NativeValueTraits<IDLLong> |
| 107 : public NativeValueTraitsBase<IDLLong> { | 103 : public NativeValueTraitsBase<IDLLong> { |
| 108 static inline int32_t nativeValue(v8::Isolate* isolate, | 104 static int32_t nativeValue(v8::Isolate* isolate, |
| 109 v8::Local<v8::Value> value, | 105 v8::Local<v8::Value> value, |
| 110 ExceptionState& exceptionState) { | 106 ExceptionState& exceptionState) { |
| 111 return nativeValue(isolate, value, exceptionState, NormalConversion); | 107 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 112 } | 108 } |
| 113 | 109 |
| 114 static inline int32_t nativeValue( | 110 static int32_t nativeValue(v8::Isolate* isolate, |
| 115 v8::Isolate* isolate, | 111 v8::Local<v8::Value> value, |
| 116 v8::Local<v8::Value> value, | 112 ExceptionState& exceptionState, |
| 117 ExceptionState& exceptionState, | 113 IntegerConversionConfiguration conversionMode) { |
| 118 IntegerConversionConfiguration conversionMode) { | |
| 119 return toInt32(isolate, value, conversionMode, exceptionState); | 114 return toInt32(isolate, value, conversionMode, exceptionState); |
| 120 } | 115 } |
| 121 }; | 116 }; |
| 122 | 117 |
| 123 template <> | 118 template <> |
| 124 struct CORE_EXPORT NativeValueTraits<IDLUnsignedLong> | 119 struct CORE_EXPORT NativeValueTraits<IDLUnsignedLong> |
| 125 : public NativeValueTraitsBase<IDLUnsignedLong> { | 120 : public NativeValueTraitsBase<IDLUnsignedLong> { |
| 126 static inline uint32_t nativeValue(v8::Isolate* isolate, | 121 static uint32_t nativeValue(v8::Isolate* isolate, |
| 127 v8::Local<v8::Value> value, | 122 v8::Local<v8::Value> value, |
| 128 ExceptionState& exceptionState) { | 123 ExceptionState& exceptionState) { |
| 129 return nativeValue(isolate, value, exceptionState, NormalConversion); | 124 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 130 } | 125 } |
| 131 | 126 |
| 132 static inline uint32_t nativeValue( | 127 static uint32_t nativeValue(v8::Isolate* isolate, |
| 133 v8::Isolate* isolate, | 128 v8::Local<v8::Value> value, |
| 134 v8::Local<v8::Value> value, | 129 ExceptionState& exceptionState, |
| 135 ExceptionState& exceptionState, | 130 IntegerConversionConfiguration conversionMode) { |
| 136 IntegerConversionConfiguration conversionMode) { | |
| 137 return toUInt32(isolate, value, conversionMode, exceptionState); | 131 return toUInt32(isolate, value, conversionMode, exceptionState); |
| 138 } | 132 } |
| 139 }; | 133 }; |
| 140 | 134 |
| 141 template <> | 135 template <> |
| 142 struct CORE_EXPORT NativeValueTraits<IDLLongLong> | 136 struct CORE_EXPORT NativeValueTraits<IDLLongLong> |
| 143 : public NativeValueTraitsBase<IDLLongLong> { | 137 : public NativeValueTraitsBase<IDLLongLong> { |
| 144 static inline int64_t nativeValue(v8::Isolate* isolate, | 138 static int64_t nativeValue(v8::Isolate* isolate, |
| 145 v8::Local<v8::Value> value, | 139 v8::Local<v8::Value> value, |
| 146 ExceptionState& exceptionState) { | 140 ExceptionState& exceptionState) { |
| 147 return nativeValue(isolate, value, exceptionState, NormalConversion); | 141 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 148 } | 142 } |
| 149 | 143 |
| 150 static inline int64_t nativeValue( | 144 static int64_t nativeValue(v8::Isolate* isolate, |
| 151 v8::Isolate* isolate, | 145 v8::Local<v8::Value> value, |
| 152 v8::Local<v8::Value> value, | 146 ExceptionState& exceptionState, |
| 153 ExceptionState& exceptionState, | 147 IntegerConversionConfiguration conversionMode) { |
| 154 IntegerConversionConfiguration conversionMode) { | |
| 155 return toInt64(isolate, value, conversionMode, exceptionState); | 148 return toInt64(isolate, value, conversionMode, exceptionState); |
| 156 } | 149 } |
| 157 }; | 150 }; |
| 158 | 151 |
| 159 template <> | 152 template <> |
| 160 struct CORE_EXPORT NativeValueTraits<IDLUnsignedLongLong> | 153 struct CORE_EXPORT NativeValueTraits<IDLUnsignedLongLong> |
| 161 : public NativeValueTraitsBase<IDLUnsignedLongLong> { | 154 : public NativeValueTraitsBase<IDLUnsignedLongLong> { |
| 162 static inline uint64_t nativeValue(v8::Isolate* isolate, | 155 static uint64_t nativeValue(v8::Isolate* isolate, |
| 163 v8::Local<v8::Value> value, | 156 v8::Local<v8::Value> value, |
| 164 ExceptionState& exceptionState) { | 157 ExceptionState& exceptionState) { |
| 165 return nativeValue(isolate, value, exceptionState, NormalConversion); | 158 return nativeValue(isolate, value, exceptionState, NormalConversion); |
| 166 } | 159 } |
| 167 | 160 |
| 168 static inline uint64_t nativeValue( | 161 static uint64_t nativeValue(v8::Isolate* isolate, |
| 169 v8::Isolate* isolate, | 162 v8::Local<v8::Value> value, |
| 170 v8::Local<v8::Value> value, | 163 ExceptionState& exceptionState, |
| 171 ExceptionState& exceptionState, | 164 IntegerConversionConfiguration conversionMode) { |
| 172 IntegerConversionConfiguration conversionMode) { | |
| 173 return toUInt64(isolate, value, conversionMode, exceptionState); | 165 return toUInt64(isolate, value, conversionMode, exceptionState); |
| 174 } | 166 } |
| 175 }; | 167 }; |
| 176 | 168 |
| 177 // Strings | 169 // Strings |
| 178 template <> | 170 template <> |
| 179 struct CORE_EXPORT NativeValueTraits<IDLByteString> | 171 struct CORE_EXPORT NativeValueTraits<IDLByteString> |
| 180 : public NativeValueTraitsBase<IDLByteString> { | 172 : public NativeValueTraitsBase<IDLByteString> { |
| 181 static inline String nativeValue(v8::Isolate* isolate, | 173 static String nativeValue(v8::Isolate* isolate, |
| 182 v8::Local<v8::Value> value, | 174 v8::Local<v8::Value> value, |
| 183 ExceptionState& exceptionState) { | 175 ExceptionState& exceptionState) { |
| 184 return toByteString(isolate, value, exceptionState); | 176 return toByteString(isolate, value, exceptionState); |
| 185 } | 177 } |
| 186 }; | 178 }; |
| 187 | 179 |
| 188 template <> | 180 template <> |
| 189 struct CORE_EXPORT NativeValueTraits<IDLString> | 181 struct CORE_EXPORT NativeValueTraits<IDLString> |
| 190 : public NativeValueTraitsBase<IDLString> { | 182 : public NativeValueTraitsBase<IDLString> { |
| 191 static inline String nativeValue(v8::Isolate* isolate, | 183 static String nativeValue(v8::Isolate* isolate, |
| 192 v8::Local<v8::Value> value, | 184 v8::Local<v8::Value> value, |
| 193 ExceptionState& exceptionState) { | 185 ExceptionState& exceptionState) { |
| 194 return nativeValue<V8StringResourceMode::DefaultMode>(isolate, value, | 186 return nativeValue<V8StringResourceMode::DefaultMode>(isolate, value, |
| 195 exceptionState); | 187 exceptionState); |
| 196 } | 188 } |
| 197 | 189 |
| 198 template <V8StringResourceMode Mode = DefaultMode> | 190 template <V8StringResourceMode Mode = DefaultMode> |
| 199 static inline String nativeValue(v8::Isolate* isolate, | 191 static String nativeValue(v8::Isolate* isolate, |
| 200 v8::Local<v8::Value> value, | 192 v8::Local<v8::Value> value, |
| 201 ExceptionState& exceptionState) { | 193 ExceptionState& exceptionState) { |
| 202 V8StringResource<Mode> string(value); | 194 V8StringResource<Mode> string(value); |
| 203 if (!string.prepare(isolate, exceptionState)) | 195 if (!string.prepare(isolate, exceptionState)) |
| 204 return String(); | 196 return String(); |
| 205 return string; | 197 return string; |
| 206 } | 198 } |
| 207 }; | 199 }; |
| 208 | 200 |
| 209 template <> | 201 template <> |
| 210 struct CORE_EXPORT NativeValueTraits<IDLUSVString> | 202 struct CORE_EXPORT NativeValueTraits<IDLUSVString> |
| 211 : public NativeValueTraitsBase<IDLUSVString> { | 203 : public NativeValueTraitsBase<IDLUSVString> { |
| 212 static inline String nativeValue(v8::Isolate* isolate, | 204 static String nativeValue(v8::Isolate* isolate, |
| 213 v8::Local<v8::Value> value, | 205 v8::Local<v8::Value> value, |
| 214 ExceptionState& exceptionState) { | 206 ExceptionState& exceptionState) { |
| 215 return toUSVString(isolate, value, exceptionState); | 207 return toUSVString(isolate, value, exceptionState); |
| 216 } | 208 } |
| 217 }; | 209 }; |
| 218 | 210 |
| 219 // Floats and doubles | 211 // Floats and doubles |
| 220 template <> | 212 template <> |
| 221 struct CORE_EXPORT NativeValueTraits<IDLDouble> | 213 struct CORE_EXPORT NativeValueTraits<IDLDouble> |
| 222 : public NativeValueTraitsBase<IDLDouble> { | 214 : public NativeValueTraitsBase<IDLDouble> { |
| 223 static inline double nativeValue(v8::Isolate* isolate, | 215 static double nativeValue(v8::Isolate* isolate, |
| 224 v8::Local<v8::Value> value, | 216 v8::Local<v8::Value> value, |
| 225 ExceptionState& exceptionState) { | 217 ExceptionState& exceptionState) { |
| 226 return toRestrictedDouble(isolate, value, exceptionState); | 218 return toRestrictedDouble(isolate, value, exceptionState); |
| 227 } | 219 } |
| 228 }; | 220 }; |
| 229 | 221 |
| 230 template <> | 222 template <> |
| 231 struct CORE_EXPORT NativeValueTraits<IDLUnrestrictedDouble> | 223 struct CORE_EXPORT NativeValueTraits<IDLUnrestrictedDouble> |
| 232 : public NativeValueTraitsBase<IDLUnrestrictedDouble> { | 224 : public NativeValueTraitsBase<IDLUnrestrictedDouble> { |
| 233 static inline double nativeValue(v8::Isolate* isolate, | 225 static double nativeValue(v8::Isolate* isolate, |
| 234 v8::Local<v8::Value> value, | 226 v8::Local<v8::Value> value, |
| 235 ExceptionState& exceptionState) { | 227 ExceptionState& exceptionState) { |
| 236 return toDouble(isolate, value, exceptionState); | 228 return toDouble(isolate, value, exceptionState); |
| 237 } | 229 } |
| 238 }; | 230 }; |
| 239 | 231 |
| 240 template <> | 232 template <> |
| 241 struct CORE_EXPORT NativeValueTraits<IDLFloat> | 233 struct CORE_EXPORT NativeValueTraits<IDLFloat> |
| 242 : public NativeValueTraitsBase<IDLFloat> { | 234 : public NativeValueTraitsBase<IDLFloat> { |
| 243 static inline float nativeValue(v8::Isolate* isolate, | 235 static float nativeValue(v8::Isolate* isolate, |
| 244 v8::Local<v8::Value> value, | 236 v8::Local<v8::Value> value, |
| 245 ExceptionState& exceptionState) { | 237 ExceptionState& exceptionState) { |
| 246 return toRestrictedFloat(isolate, value, exceptionState); | 238 return toRestrictedFloat(isolate, value, exceptionState); |
| 247 } | 239 } |
| 248 }; | 240 }; |
| 249 | 241 |
| 250 template <> | 242 template <> |
| 251 struct CORE_EXPORT NativeValueTraits<IDLUnrestrictedFloat> | 243 struct CORE_EXPORT NativeValueTraits<IDLUnrestrictedFloat> |
| 252 : public NativeValueTraitsBase<IDLUnrestrictedFloat> { | 244 : public NativeValueTraitsBase<IDLUnrestrictedFloat> { |
| 253 static inline float nativeValue(v8::Isolate* isolate, | 245 static float nativeValue(v8::Isolate* isolate, |
| 254 v8::Local<v8::Value> value, | 246 v8::Local<v8::Value> value, |
| 255 ExceptionState& exceptionState) { | 247 ExceptionState& exceptionState) { |
| 256 return toFloat(isolate, value, exceptionState); | 248 return toFloat(isolate, value, exceptionState); |
| 257 } | 249 } |
| 258 }; | 250 }; |
| 259 | 251 |
| 260 // Promises | 252 // Promises |
| 261 template <> | 253 template <> |
| 262 struct CORE_EXPORT NativeValueTraits<IDLPromise> | 254 struct CORE_EXPORT NativeValueTraits<IDLPromise> |
| 263 : public NativeValueTraitsBase<IDLPromise> { | 255 : public NativeValueTraitsBase<IDLPromise> { |
| 264 static inline ScriptPromise nativeValue(v8::Isolate* isolate, | 256 static ScriptPromise nativeValue(v8::Isolate* isolate, |
| 265 v8::Local<v8::Value> value, | 257 v8::Local<v8::Value> value, |
| 266 ExceptionState& exceptionState) { | 258 ExceptionState& exceptionState) { |
| 267 return nativeValue(isolate, value); | 259 return nativeValue(isolate, value); |
| 268 } | 260 } |
| 269 | 261 |
| 270 static inline ScriptPromise nativeValue(v8::Isolate* isolate, | 262 static ScriptPromise nativeValue(v8::Isolate* isolate, |
| 271 v8::Local<v8::Value> value) { | 263 v8::Local<v8::Value> value) { |
| 272 return ScriptPromise::cast(ScriptState::current(isolate), value); | 264 return ScriptPromise::cast(ScriptState::current(isolate), value); |
| 273 } | 265 } |
| 274 }; | 266 }; |
| 275 | 267 |
| 276 // Type-specific overloads | 268 // Type-specific overloads |
| 277 template <> | 269 template <> |
| 278 struct CORE_EXPORT NativeValueTraits<IDLDate> | 270 struct CORE_EXPORT NativeValueTraits<IDLDate> |
| 279 : public NativeValueTraitsBase<IDLDate> { | 271 : public NativeValueTraitsBase<IDLDate> { |
| 280 static inline double nativeValue(v8::Isolate* isolate, | 272 static double nativeValue(v8::Isolate* isolate, |
| 281 v8::Local<v8::Value> value, | 273 v8::Local<v8::Value> value, |
| 282 ExceptionState& exceptionState) { | 274 ExceptionState& exceptionState) { |
| 283 return toCoreDate(isolate, value, exceptionState); | 275 return toCoreDate(isolate, value, exceptionState); |
| 284 } | 276 } |
| 285 }; | 277 }; |
| 286 | 278 |
| 287 // Sequences | 279 // Sequences |
| 288 template <typename T> | 280 template <typename T> |
| 289 struct NativeValueTraits<IDLSequence<T>> | 281 struct NativeValueTraits<IDLSequence<T>> |
| 290 : public NativeValueTraitsBase<IDLSequence<T>> { | 282 : public NativeValueTraitsBase<IDLSequence<T>> { |
| 291 // Nondependent types need to be explicitly qualified to be accessible. | 283 // Nondependent types need to be explicitly qualified to be accessible. |
| 292 using typename NativeValueTraitsBase<IDLSequence<T>>::ImplType; | 284 using typename NativeValueTraitsBase<IDLSequence<T>>::ImplType; |
| 293 | 285 |
| 294 static inline ImplType nativeValue(v8::Isolate* isolate, | 286 static ImplType nativeValue(v8::Isolate* isolate, |
| 295 v8::Local<v8::Value> value, | 287 v8::Local<v8::Value> value, |
| 296 ExceptionState& exceptionState) { | 288 ExceptionState& exceptionState) { |
| 297 return nativeValue(isolate, value, exceptionState, 0); | 289 return nativeValue(isolate, value, exceptionState, 0); |
| 298 } | 290 } |
| 299 | 291 |
| 300 static inline ImplType nativeValue(v8::Isolate* isolate, | 292 static ImplType nativeValue(v8::Isolate* isolate, |
| 301 v8::Local<v8::Value> value, | 293 v8::Local<v8::Value> value, |
| 302 ExceptionState& exceptionState, | 294 ExceptionState& exceptionState, |
| 303 int index) { | 295 int index) { |
| 304 return toImplArray<ImplType, T>(value, index, isolate, exceptionState); | 296 return toImplArray<ImplType, T>(value, index, isolate, exceptionState); |
| 305 } | 297 } |
| 306 }; | 298 }; |
| 307 | 299 |
| 308 // Records | 300 // Records |
| 309 template <typename K, typename V> | 301 template <typename K, typename V> |
| 310 struct NativeValueTraits<IDLRecord<K, V>> | 302 struct NativeValueTraits<IDLRecord<K, V>> |
| 311 : public NativeValueTraitsBase<IDLRecord<K, V>> { | 303 : public NativeValueTraitsBase<IDLRecord<K, V>> { |
| 312 // Nondependent types need to be explicitly qualified to be accessible. | 304 // Nondependent types need to be explicitly qualified to be accessible. |
| 313 using typename NativeValueTraitsBase<IDLRecord<K, V>>::ImplType; | 305 using typename NativeValueTraitsBase<IDLRecord<K, V>>::ImplType; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 418 } |
| 427 } | 419 } |
| 428 // "5. Return result." | 420 // "5. Return result." |
| 429 return result; | 421 return result; |
| 430 } | 422 } |
| 431 }; | 423 }; |
| 432 | 424 |
| 433 } // namespace blink | 425 } // namespace blink |
| 434 | 426 |
| 435 #endif // NativeValueTraitsImpl_h | 427 #endif // NativeValueTraitsImpl_h |
| OLD | NEW |