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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. | 608 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. |
609 // | 609 // |
610 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). | 610 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). |
611 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) | 611 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) |
612 { | 612 { |
613 return isolate ? v8Boolean(value, isolate) : v8Boolean(value, v8::Isolat
e::GetCurrent()); | 613 return isolate ? v8Boolean(value, isolate) : v8Boolean(value, v8::Isolat
e::GetCurrent()); |
614 } | 614 } |
615 | 615 |
616 inline double toWebCoreDate(v8::Handle<v8::Value> object) | 616 inline double toWebCoreDate(v8::Handle<v8::Value> object) |
617 { | 617 { |
618 return (object->IsDate() || object->IsNumber()) ? object->NumberValue()
: std::numeric_limits<double>::quiet_NaN(); | 618 if (object->IsDate()) |
| 619 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
| 620 if (object->IsNumber()) |
| 621 return object->NumberValue(); |
| 622 return std::numeric_limits<double>::quiet_NaN(); |
619 } | 623 } |
620 | 624 |
621 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) | 625 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) |
622 { | 626 { |
623 ASSERT(isolate); | 627 ASSERT(isolate); |
624 return std::isfinite(value) ? v8::Date::New(isolate, value) : v8::Handle
<v8::Value>::Cast(v8::Null(isolate)); | 628 return std::isfinite(value) ? v8::Date::New(isolate, value) : v8::Handle
<v8::Value>::Cast(v8::Null(isolate)); |
625 } | 629 } |
626 | 630 |
627 inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const cha
r* str) | 631 inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const cha
r* str) |
628 { | 632 { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 714 |
711 // Converts a DOM object to a v8 value. | 715 // Converts a DOM object to a v8 value. |
712 // This is a no-inline version of toV8(). If you want to call toV8() | 716 // This is a no-inline version of toV8(). If you want to call toV8() |
713 // without creating #include cycles, you can use this function instead. | 717 // without creating #include cycles, you can use this function instead. |
714 // Each specialized implementation will be generated. | 718 // Each specialized implementation will be generated. |
715 template<typename T> | 719 template<typename T> |
716 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); | 720 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); |
717 } // namespace WebCore | 721 } // namespace WebCore |
718 | 722 |
719 #endif // V8Binding_h | 723 #endif // V8Binding_h |
OLD | NEW |