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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 typedef NativeValueTraits<ValueType> TraitsType; | 797 typedef NativeValueTraits<ValueType> TraitsType; |
798 result.reserveInitialCapacity(value.size()); | 798 result.reserveInitialCapacity(value.size()); |
799 for (unsigned i = 0; i < value.size(); ++i) { | 799 for (unsigned i = 0; i < value.size(); ++i) { |
800 result.uncheckedAppend(TraitsType::nativeValue(isolate, value[i].v8Value
(), exceptionState)); | 800 result.uncheckedAppend(TraitsType::nativeValue(isolate, value[i].v8Value
(), exceptionState)); |
801 if (exceptionState.hadException()) | 801 if (exceptionState.hadException()) |
802 return VectorType(); | 802 return VectorType(); |
803 } | 803 } |
804 return result; | 804 return result; |
805 } | 805 } |
806 | 806 |
807 template <typename T> | 807 template <typename VectorType> |
808 Vector<T> toImplArguments(const v8::FunctionCallbackInfo<v8::Value>& info, int s
tartIndex, ExceptionState& exceptionState) | 808 VectorType toImplArguments(const v8::FunctionCallbackInfo<v8::Value>& info, int
startIndex, ExceptionState& exceptionState) |
809 { | 809 { |
810 Vector<T> result; | 810 VectorType result; |
811 typedef NativeValueTraits<T> TraitsType; | 811 typedef typename VectorType::ValueType ValueType; |
| 812 typedef NativeValueTraits<ValueType> TraitsType; |
812 int length = info.Length(); | 813 int length = info.Length(); |
813 if (startIndex < length) { | 814 if (startIndex < length) { |
814 result.reserveInitialCapacity(length - startIndex); | 815 result.reserveInitialCapacity(length - startIndex); |
815 for (int i = startIndex; i < length; ++i) { | 816 for (int i = startIndex; i < length; ++i) { |
816 result.uncheckedAppend(TraitsType::nativeValue(info.GetIsolate(), in
fo[i], exceptionState)); | 817 result.uncheckedAppend(TraitsType::nativeValue(info.GetIsolate(), in
fo[i], exceptionState)); |
817 if (exceptionState.hadException()) | 818 if (exceptionState.hadException()) |
818 return Vector<T>(); | 819 return VectorType(); |
819 } | 820 } |
820 } | 821 } |
821 return result; | 822 return result; |
822 } | 823 } |
823 | 824 |
824 // Validates that the passed object is a sequence type per WebIDL spec | 825 // Validates that the passed object is a sequence type per WebIDL spec |
825 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-sequence | 826 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-sequence |
826 inline bool toV8Sequence(v8::Local<v8::Value> value, uint32_t& length, v8::Isola
te* isolate, ExceptionState& exceptionState) | 827 inline bool toV8Sequence(v8::Local<v8::Value> value, uint32_t& length, v8::Isola
te* isolate, ExceptionState& exceptionState) |
827 { | 828 { |
828 // Attempt converting to a sequence if the value is not already an array but
is | 829 // Attempt converting to a sequence if the value is not already an array but
is |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); | 1065 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); |
1065 | 1066 |
1066 // Callback functions used by generated code. | 1067 // Callback functions used by generated code. |
1067 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 1068 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
1068 | 1069 |
1069 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1070 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
1070 | 1071 |
1071 } // namespace blink | 1072 } // namespace blink |
1072 | 1073 |
1073 #endif // V8Binding_h | 1074 #endif // V8Binding_h |
OLD | NEW |