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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 { | 285 { |
286 v8::Local<v8::Array> result = v8::Array::New(isolate, iterator.size()); | 286 v8::Local<v8::Array> result = v8::Array::New(isolate, iterator.size()); |
287 int index = 0; | 287 int index = 0; |
288 typename HeapVector<T, inlineCapacity>::const_iterator end = iterator.end(); | 288 typename HeapVector<T, inlineCapacity>::const_iterator end = iterator.end(); |
289 typedef V8ValueTraits<T> TraitsType; | 289 typedef V8ValueTraits<T> TraitsType; |
290 for (typename HeapVector<T, inlineCapacity>::const_iterator iter = iterator.
begin(); iter != end; ++iter) | 290 for (typename HeapVector<T, inlineCapacity>::const_iterator iter = iterator.
begin(); iter != end; ++iter) |
291 result->Set(v8::Integer::New(isolate, index++), TraitsType::arrayV8Value
(*iter, isolate)); | 291 result->Set(v8::Integer::New(isolate, index++), TraitsType::arrayV8Value
(*iter, isolate)); |
292 return result; | 292 return result; |
293 } | 293 } |
294 | 294 |
| 295 template<typename T, size_t inlineCapacity> |
| 296 v8::Handle<v8::Value> v8ArrayNoInline(const Vector<T, inlineCapacity>& iterator,
v8::Isolate* isolate) |
| 297 { |
| 298 v8::Local<v8::Array> result = v8::Array::New(isolate, iterator.size()); |
| 299 int index = 0; |
| 300 typename Vector<T, inlineCapacity>::const_iterator end = iterator.end(); |
| 301 for (typename Vector<T, inlineCapacity>::const_iterator iter = iterator.begi
n(); iter != end; ++iter) |
| 302 result->Set(v8::Integer::New(isolate, index++), toV8NoInline(WTF::getPtr
(*iter), v8::Handle<v8::Object>(), isolate)); |
| 303 return result; |
| 304 } |
| 305 |
295 // Conversion flags, used in toIntXX/toUIntXX. | 306 // Conversion flags, used in toIntXX/toUIntXX. |
296 enum IntegerConversionConfiguration { | 307 enum IntegerConversionConfiguration { |
297 NormalConversion, | 308 NormalConversion, |
298 EnforceRange, | 309 EnforceRange, |
299 Clamp | 310 Clamp |
300 }; | 311 }; |
301 | 312 |
302 // Convert a value to a 8-bit signed integer. The conversion fails if the | 313 // Convert a value to a 8-bit signed integer. The conversion fails if the |
303 // value cannot be converted to a number or the range violated per WebIDL: | 314 // value cannot be converted to a number or the range violated per WebIDL: |
304 // http://www.w3.org/TR/WebIDL/#es-byte | 315 // http://www.w3.org/TR/WebIDL/#es-byte |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 v8::HandleScope m_handleScope; | 750 v8::HandleScope m_handleScope; |
740 v8::Handle<v8::Context> m_context; | 751 v8::Handle<v8::Context> m_context; |
741 v8::Context::Scope m_contextScope; | 752 v8::Context::Scope m_contextScope; |
742 RefPtr<DOMWrapperWorld> m_world; | 753 RefPtr<DOMWrapperWorld> m_world; |
743 OwnPtr<V8PerContextData> m_perContextData; | 754 OwnPtr<V8PerContextData> m_perContextData; |
744 }; | 755 }; |
745 | 756 |
746 } // namespace WebCore | 757 } // namespace WebCore |
747 | 758 |
748 #endif // V8Binding_h | 759 #endif // V8Binding_h |
OLD | NEW |