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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 }; | 219 }; |
220 | 220 |
221 template<> | 221 template<> |
222 struct V8ValueTraits<double> { | 222 struct V8ValueTraits<double> { |
223 static inline v8::Handle<v8::Value> arrayV8Value(const double& value, v8
::Isolate*) | 223 static inline v8::Handle<v8::Value> arrayV8Value(const double& value, v8
::Isolate*) |
224 { | 224 { |
225 return v8::Number::New(value); | 225 return v8::Number::New(value); |
226 } | 226 } |
227 }; | 227 }; |
228 | 228 |
229 template<typename T> | 229 template<typename T, size_t inlineCapacity> |
230 v8::Handle<v8::Value> v8Array(const Vector<T>& iterator, v8::Isolate* isolat
e) | 230 v8::Handle<v8::Value> v8Array(const Vector<T, inlineCapacity>& iterator, v8:
:Isolate* isolate) |
231 { | 231 { |
232 v8::Local<v8::Array> result = v8::Array::New(iterator.size()); | 232 v8::Local<v8::Array> result = v8::Array::New(iterator.size()); |
233 int index = 0; | 233 int index = 0; |
234 typename Vector<T>::const_iterator end = iterator.end(); | 234 typename Vector<T, inlineCapacity>::const_iterator end = iterator.end(); |
235 typedef V8ValueTraits<T> TraitsType; | 235 typedef V8ValueTraits<T> TraitsType; |
236 for (typename Vector<T>::const_iterator iter = iterator.begin(); iter !=
end; ++iter) | 236 for (typename Vector<T, inlineCapacity>::const_iterator iter = iterator.
begin(); iter != end; ++iter) |
237 result->Set(v8Integer(index++, isolate), TraitsType::arrayV8Value(*i
ter, isolate)); | 237 result->Set(v8Integer(index++, isolate), TraitsType::arrayV8Value(*i
ter, isolate)); |
238 return result; | 238 return result; |
239 } | 239 } |
240 | 240 |
241 v8::Handle<v8::Value> v8Array(PassRefPtr<DOMStringList>, v8::Isolate*); | 241 v8::Handle<v8::Value> v8Array(PassRefPtr<DOMStringList>, v8::Isolate*); |
242 | 242 |
243 // Conversion flags, used in toIntXX/toUIntXX. | 243 // Conversion flags, used in toIntXX/toUIntXX. |
244 enum IntegerConversionConfiguration { | 244 enum IntegerConversionConfiguration { |
245 NormalConversion, | 245 NormalConversion, |
246 EnforceRange, | 246 EnforceRange, |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // is disabled and it returns true. | 498 // is disabled and it returns true. |
499 bool handleOutOfMemory(); | 499 bool handleOutOfMemory(); |
500 // FIXME: This should receive an Isolate. | 500 // FIXME: This should receive an Isolate. |
501 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); | 501 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); |
502 | 502 |
503 void crashIfV8IsDead(); | 503 void crashIfV8IsDead(); |
504 | 504 |
505 } // namespace WebCore | 505 } // namespace WebCore |
506 | 506 |
507 #endif // V8Binding_h | 507 #endif // V8Binding_h |
OLD | NEW |