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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 } | 677 } |
678 | 678 |
679 WillBeHeapVector<RefPtrWillBeMember<T> > result; | 679 WillBeHeapVector<RefPtrWillBeMember<T> > result; |
680 result.reserveInitialCapacity(length); | 680 result.reserveInitialCapacity(length); |
681 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); | 681 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); |
682 v8::TryCatch block; | 682 v8::TryCatch block; |
683 for (uint32_t i = 0; i < length; ++i) { | 683 for (uint32_t i = 0; i < length; ++i) { |
684 v8::Handle<v8::Value> element = object->Get(i); | 684 v8::Handle<v8::Value> element = object->Get(i); |
685 if (block.HasCaught()) { | 685 if (block.HasCaught()) { |
686 exceptionState.rethrowV8Exception(block.Exception()); | 686 exceptionState.rethrowV8Exception(block.Exception()); |
687 return Vector<RefPtr<T> >(); | 687 return WillBeHeapVector<RefPtrWillBeMember<T> >(); |
688 } | 688 } |
689 if (V8T::hasInstance(element, isolate)) { | 689 if (V8T::hasInstance(element, isolate)) { |
690 v8::Handle<v8::Object> elementObject = v8::Handle<v8::Object>::Cast(
element); | 690 v8::Handle<v8::Object> elementObject = v8::Handle<v8::Object>::Cast(
element); |
691 result.uncheckedAppend(V8T::toImpl(elementObject)); | 691 result.uncheckedAppend(V8T::toImpl(elementObject)); |
692 } else { | 692 } else { |
693 exceptionState.throwTypeError("Invalid Array element type"); | 693 exceptionState.throwTypeError("Invalid Array element type"); |
694 return WillBeHeapVector<RefPtrWillBeMember<T> >(); | 694 return WillBeHeapVector<RefPtrWillBeMember<T> >(); |
695 } | 695 } |
696 } | 696 } |
697 return result; | 697 return result; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 v8::Local<v8::Value> v8IteratorResult(v8::Isolate*, v8::Handle<v8::Value>); | 1018 v8::Local<v8::Value> v8IteratorResult(v8::Isolate*, v8::Handle<v8::Value>); |
1019 template <typename T> | 1019 template <typename T> |
1020 v8::Local<v8::Value> v8IteratorResult(ScriptState* scriptState, const T& value) | 1020 v8::Local<v8::Value> v8IteratorResult(ScriptState* scriptState, const T& value) |
1021 { | 1021 { |
1022 return v8IteratorResult(scriptState->isolate(), V8ValueTraits<T>::toV8Value(
value, scriptState->context()->Global(), scriptState->isolate())); | 1022 return v8IteratorResult(scriptState->isolate(), V8ValueTraits<T>::toV8Value(
value, scriptState->context()->Global(), scriptState->isolate())); |
1023 } | 1023 } |
1024 | 1024 |
1025 } // namespace blink | 1025 } // namespace blink |
1026 | 1026 |
1027 #endif // V8Binding_h | 1027 #endif // V8Binding_h |
OLD | NEW |