| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array | 450 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array |
| 451 template <class T, class V8T> | 451 template <class T, class V8T> |
| 452 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value
, uint32_t length, v8::Isolate* isolate, bool* success = 0) | 452 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value
, uint32_t length, v8::Isolate* isolate, bool* success = 0) |
| 453 { | 453 { |
| 454 Vector<RefPtr<T> > result; | 454 Vector<RefPtr<T> > result; |
| 455 result.reserveInitialCapacity(length); | 455 result.reserveInitialCapacity(length); |
| 456 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); | 456 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); |
| 457 for (uint32_t i = 0; i < length; ++i) { | 457 for (uint32_t i = 0; i < length; ++i) { |
| 458 v8::Handle<v8::Value> element = object->Get(i); | 458 v8::Handle<v8::Value> element = object->Get(i); |
| 459 | 459 |
| 460 if (V8T::hasInstance(element, isolate, worldType(isolate))) { | 460 if (V8T::hasInstance(element, isolate)) { |
| 461 v8::Handle<v8::Object> elementObject = v8::Handle<v8::Object>::C
ast(element); | 461 v8::Handle<v8::Object> elementObject = v8::Handle<v8::Object>::C
ast(element); |
| 462 result.uncheckedAppend(V8T::toNative(elementObject)); | 462 result.uncheckedAppend(V8T::toNative(elementObject)); |
| 463 } else { | 463 } else { |
| 464 if (success) | 464 if (success) |
| 465 *success = false; | 465 *success = false; |
| 466 throwTypeError("Invalid Array element type", isolate); | 466 throwTypeError("Invalid Array element type", isolate); |
| 467 return Vector<RefPtr<T> >(); | 467 return Vector<RefPtr<T> >(); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 return result; | 470 return result; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 } | 730 } |
| 731 | 731 |
| 732 private: | 732 private: |
| 733 v8::Isolate* m_isolate; | 733 v8::Isolate* m_isolate; |
| 734 }; | 734 }; |
| 735 #endif | 735 #endif |
| 736 | 736 |
| 737 } // namespace WebCore | 737 } // namespace WebCore |
| 738 | 738 |
| 739 #endif // V8Binding_h | 739 #endif // V8Binding_h |
| OLD | NEW |