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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. | 630 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. |
631 // | 631 // |
632 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). | 632 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). |
633 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) | 633 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) |
634 { | 634 { |
635 return isolate ? v8Boolean(value, isolate) : v8Boolean(value); | 635 return isolate ? v8Boolean(value, isolate) : v8Boolean(value); |
636 } | 636 } |
637 | 637 |
638 inline double toWebCoreDate(v8::Handle<v8::Value> object) | 638 inline double toWebCoreDate(v8::Handle<v8::Value> object) |
639 { | 639 { |
640 return (object->IsDate() || object->IsNumber()) ? object->NumberValue()
: std::numeric_limits<double>::quiet_NaN(); | 640 if (object->IsDate()) |
| 641 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
| 642 if (object->IsNumber()) |
| 643 return object->NumberValue(); |
| 644 return std::numeric_limits<double>::quiet_NaN(); |
641 } | 645 } |
642 | 646 |
643 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) | 647 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) |
644 { | 648 { |
645 ASSERT(isolate); | 649 ASSERT(isolate); |
646 return std::isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(iso
late); | 650 return std::isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(iso
late); |
647 } | 651 } |
648 | 652 |
649 v8::Handle<v8::FunctionTemplate> createRawTemplate(v8::Isolate*); | 653 v8::Handle<v8::FunctionTemplate> createRawTemplate(v8::Isolate*); |
650 | 654 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 716 |
713 v8::Isolate* mainThreadIsolate(); | 717 v8::Isolate* mainThreadIsolate(); |
714 v8::Isolate* toIsolate(ExecutionContext*); | 718 v8::Isolate* toIsolate(ExecutionContext*); |
715 v8::Isolate* toIsolate(Frame*); | 719 v8::Isolate* toIsolate(Frame*); |
716 | 720 |
717 // Can only be called by blink::initialize | 721 // Can only be called by blink::initialize |
718 void setMainThreadIsolate(v8::Isolate*); | 722 void setMainThreadIsolate(v8::Isolate*); |
719 } // namespace WebCore | 723 } // namespace WebCore |
720 | 724 |
721 #endif // V8Binding_h | 725 #endif // V8Binding_h |
OLD | NEW |