| 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. | 626 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. |
| 627 // | 627 // |
| 628 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). | 628 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). |
| 629 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) | 629 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) |
| 630 { | 630 { |
| 631 return isolate ? v8Boolean(value, isolate) : v8Boolean(value, v8::Isolat
e::GetCurrent()); | 631 return isolate ? v8Boolean(value, isolate) : v8Boolean(value, v8::Isolat
e::GetCurrent()); |
| 632 } | 632 } |
| 633 | 633 |
| 634 inline double toWebCoreDate(v8::Handle<v8::Value> object) | 634 inline double toWebCoreDate(v8::Handle<v8::Value> object) |
| 635 { | 635 { |
| 636 return (object->IsDate() || object->IsNumber()) ? object->NumberValue()
: std::numeric_limits<double>::quiet_NaN(); | 636 if (object->IsDate()) |
| 637 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
| 638 if (object->IsNumber()) |
| 639 return object->NumberValue(); |
| 640 return std::numeric_limits<double>::quiet_NaN(); |
| 637 } | 641 } |
| 638 | 642 |
| 639 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) | 643 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) |
| 640 { | 644 { |
| 641 ASSERT(isolate); | 645 ASSERT(isolate); |
| 642 return std::isfinite(value) ? v8::Date::New(isolate, value) : v8NullWith
Check(isolate); | 646 return std::isfinite(value) ? v8::Date::New(isolate, value) : v8NullWith
Check(isolate); |
| 643 } | 647 } |
| 644 | 648 |
| 645 inline v8::Handle<v8::String> v8Symbol(const char* str, v8::Isolate* isolate
) | 649 inline v8::Handle<v8::String> v8Symbol(const char* str, v8::Isolate* isolate
) |
| 646 { | 650 { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 726 |
| 723 // Converts a DOM object to a v8 value. | 727 // Converts a DOM object to a v8 value. |
| 724 // This is a no-inline version of toV8(). If you want to call toV8() | 728 // This is a no-inline version of toV8(). If you want to call toV8() |
| 725 // without creating #include cycles, you can use this function instead. | 729 // without creating #include cycles, you can use this function instead. |
| 726 // Each specialized implementation will be generated. | 730 // Each specialized implementation will be generated. |
| 727 template<typename T> | 731 template<typename T> |
| 728 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); | 732 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); |
| 729 } // namespace WebCore | 733 } // namespace WebCore |
| 730 | 734 |
| 731 #endif // V8Binding_h | 735 #endif // V8Binding_h |
| OLD | NEW |