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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. | 639 // we need to use v8BooleanWithCheck(value, isolate) if an isolate can be nu
ll. |
640 // | 640 // |
641 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). | 641 // FIXME: Remove all null isolates from V8 bindings, and remove v8BooleanWit
hCheck(value, isolate). |
642 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) | 642 inline v8::Handle<v8::Boolean> v8BooleanWithCheck(bool value, v8::Isolate* i
solate) |
643 { | 643 { |
644 return isolate ? v8Boolean(value, isolate) : v8Boolean(value); | 644 return isolate ? v8Boolean(value, isolate) : v8Boolean(value); |
645 } | 645 } |
646 | 646 |
647 inline double toWebCoreDate(v8::Handle<v8::Value> object) | 647 inline double toWebCoreDate(v8::Handle<v8::Value> object) |
648 { | 648 { |
649 return (object->IsDate() || object->IsNumber()) ? object->NumberValue()
: std::numeric_limits<double>::quiet_NaN(); | 649 if (object->IsDate()) |
| 650 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
| 651 if (object->IsNumber()) |
| 652 return object->NumberValue(); |
| 653 return std::numeric_limits<double>::quiet_NaN(); |
650 } | 654 } |
651 | 655 |
652 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) | 656 inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate
) |
653 { | 657 { |
654 ASSERT(isolate); | 658 ASSERT(isolate); |
655 return std::isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(iso
late); | 659 return std::isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(iso
late); |
656 } | 660 } |
657 | 661 |
658 v8::Handle<v8::FunctionTemplate> createRawTemplate(v8::Isolate*); | 662 v8::Handle<v8::FunctionTemplate> createRawTemplate(v8::Isolate*); |
659 | 663 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 | 725 |
722 v8::Isolate* mainThreadIsolate(); | 726 v8::Isolate* mainThreadIsolate(); |
723 v8::Isolate* toIsolate(ExecutionContext*); | 727 v8::Isolate* toIsolate(ExecutionContext*); |
724 v8::Isolate* toIsolate(Frame*); | 728 v8::Isolate* toIsolate(Frame*); |
725 | 729 |
726 // Can only be called by blink::initialize | 730 // Can only be called by blink::initialize |
727 void setMainThreadIsolate(v8::Isolate*); | 731 void setMainThreadIsolate(v8::Isolate*); |
728 } // namespace WebCore | 732 } // namespace WebCore |
729 | 733 |
730 #endif // V8Binding_h | 734 #endif // V8Binding_h |
OLD | NEW |