| 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 15 matching lines...) Expand all Loading... |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef V8Binding_h | 32 #ifndef V8Binding_h |
| 33 #define V8Binding_h | 33 #define V8Binding_h |
| 34 | 34 |
| 35 #include "bindings/v8/DOMWrapperWorld.h" | 35 #include "bindings/v8/DOMWrapperWorld.h" |
| 36 #include "bindings/v8/ScriptValue.h" |
| 36 #include "bindings/v8/V8BindingMacros.h" | 37 #include "bindings/v8/V8BindingMacros.h" |
| 37 #include "bindings/v8/V8PerIsolateData.h" | 38 #include "bindings/v8/V8PerIsolateData.h" |
| 38 #include "bindings/v8/V8StringResource.h" | 39 #include "bindings/v8/V8StringResource.h" |
| 39 #include "bindings/v8/V8ThrowException.h" | 40 #include "bindings/v8/V8ThrowException.h" |
| 40 #include "bindings/v8/V8ValueCache.h" | 41 #include "bindings/v8/V8ValueCache.h" |
| 41 #include "wtf/MathExtras.h" | 42 #include "wtf/MathExtras.h" |
| 42 #include "wtf/text/AtomicString.h" | 43 #include "wtf/text/AtomicString.h" |
| 43 #include <v8.h> | 44 #include <v8.h> |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 }; | 333 }; |
| 333 | 334 |
| 334 template<> | 335 template<> |
| 335 struct NativeValueTraits<double> { | 336 struct NativeValueTraits<double> { |
| 336 static inline double nativeValue(const v8::Handle<v8::Value>& value) | 337 static inline double nativeValue(const v8::Handle<v8::Value>& value) |
| 337 { | 338 { |
| 338 return static_cast<double>(value->NumberValue()); | 339 return static_cast<double>(value->NumberValue()); |
| 339 } | 340 } |
| 340 }; | 341 }; |
| 341 | 342 |
| 343 template<> |
| 344 struct NativeValueTraits<ScriptValue> { |
| 345 static inline ScriptValue nativeValue(const v8::Handle<v8::Value>& value
) |
| 346 { |
| 347 return ScriptValue(value); |
| 348 } |
| 349 }; |
| 350 |
| 342 template <class T, class V8T> | 351 template <class T, class V8T> |
| 343 Vector<RefPtr<T> > toRefPtrNativeArray(v8::Handle<v8::Value> value, v8::Isol
ate* isolate) | 352 Vector<RefPtr<T> > toRefPtrNativeArray(v8::Handle<v8::Value> value, v8::Isol
ate* isolate) |
| 344 { | 353 { |
| 345 if (!value->IsArray()) | 354 if (!value->IsArray()) |
| 346 return Vector<RefPtr<T> >(); | 355 return Vector<RefPtr<T> >(); |
| 347 | 356 |
| 348 Vector<RefPtr<T> > result; | 357 Vector<RefPtr<T> > result; |
| 349 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); | 358 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); |
| 350 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(v8Value); | 359 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(v8Value); |
| 351 size_t length = array->Length(); | 360 size_t length = array->Length(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // is disabled and it returns true. | 507 // is disabled and it returns true. |
| 499 bool handleOutOfMemory(); | 508 bool handleOutOfMemory(); |
| 500 // FIXME: This should receive an Isolate. | 509 // FIXME: This should receive an Isolate. |
| 501 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); | 510 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); |
| 502 | 511 |
| 503 void crashIfV8IsDead(); | 512 void crashIfV8IsDead(); |
| 504 | 513 |
| 505 } // namespace WebCore | 514 } // namespace WebCore |
| 506 | 515 |
| 507 #endif // V8Binding_h | 516 #endif // V8Binding_h |
| OLD | NEW |