| 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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } else { | 754 } else { |
| 755 exceptionState.throwTypeError("Invalid Array element type"); | 755 exceptionState.throwTypeError("Invalid Array element type"); |
| 756 return VectorType(); | 756 return VectorType(); |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 return result; | 759 return result; |
| 760 } | 760 } |
| 761 | 761 |
| 762 // Converts a JavaScript value to an array as per the Web IDL specification: | 762 // Converts a JavaScript value to an array as per the Web IDL specification: |
| 763 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array | 763 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array |
| 764 template <typename VectorType> | 764 template <typename VectorType, |
| 765 typename ValueType = typename VectorType::ValueType> |
| 765 VectorType toImplArray(v8::Local<v8::Value> value, | 766 VectorType toImplArray(v8::Local<v8::Value> value, |
| 766 int argumentIndex, | 767 int argumentIndex, |
| 767 v8::Isolate* isolate, | 768 v8::Isolate* isolate, |
| 768 ExceptionState& exceptionState) { | 769 ExceptionState& exceptionState) { |
| 769 typedef typename VectorType::ValueType ValueType; | |
| 770 typedef NativeValueTraits<ValueType> TraitsType; | 770 typedef NativeValueTraits<ValueType> TraitsType; |
| 771 | 771 |
| 772 uint32_t length = 0; | 772 uint32_t length = 0; |
| 773 if (value->IsArray()) { | 773 if (value->IsArray()) { |
| 774 length = v8::Local<v8::Array>::Cast(value)->Length(); | 774 length = v8::Local<v8::Array>::Cast(value)->Length(); |
| 775 } else if (!toV8Sequence(value, length, isolate, exceptionState)) { | 775 } else if (!toV8Sequence(value, length, isolate, exceptionState)) { |
| 776 if (!exceptionState.hadException()) | 776 if (!exceptionState.hadException()) |
| 777 exceptionState.throwTypeError( | 777 exceptionState.throwTypeError( |
| 778 ExceptionMessages::notAnArrayTypeArgumentOrValue(argumentIndex)); | 778 ExceptionMessages::notAnArrayTypeArgumentOrValue(argumentIndex)); |
| 779 return VectorType(); | 779 return VectorType(); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 // If the argument isn't an object, this will crash. | 1160 // If the argument isn't an object, this will crash. |
| 1161 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, | 1161 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, |
| 1162 v8::Isolate*); | 1162 v8::Isolate*); |
| 1163 | 1163 |
| 1164 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, | 1164 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, |
| 1165 const String& stringifiedJSON, | 1165 const String& stringifiedJSON, |
| 1166 ExceptionState&); | 1166 ExceptionState&); |
| 1167 } // namespace blink | 1167 } // namespace blink |
| 1168 | 1168 |
| 1169 #endif // V8Binding_h | 1169 #endif // V8Binding_h |
| OLD | NEW |