| 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/Dictionary.h" |
| 36 #include "bindings/v8/ExceptionMessages.h" | 37 #include "bindings/v8/ExceptionMessages.h" |
| 37 #include "bindings/v8/V8BindingMacros.h" | 38 #include "bindings/v8/V8BindingMacros.h" |
| 38 #include "bindings/v8/V8PerIsolateData.h" | 39 #include "bindings/v8/V8PerIsolateData.h" |
| 39 #include "bindings/v8/V8StringResource.h" | 40 #include "bindings/v8/V8StringResource.h" |
| 40 #include "bindings/v8/V8ThrowException.h" | 41 #include "bindings/v8/V8ThrowException.h" |
| 41 #include "bindings/v8/V8ValueCache.h" | 42 #include "bindings/v8/V8ValueCache.h" |
| 42 #include "wtf/MathExtras.h" | 43 #include "wtf/MathExtras.h" |
| 43 #include "wtf/text/AtomicString.h" | 44 #include "wtf/text/AtomicString.h" |
| 44 #include <v8.h> | 45 #include <v8.h> |
| 45 | 46 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 // The caller is responsible for reporting a TypeError. | 592 // The caller is responsible for reporting a TypeError. |
| 592 return v8Undefined(); | 593 return v8Undefined(); |
| 593 } | 594 } |
| 594 | 595 |
| 595 V8TRYCATCH(uint32_t, sequenceLength, lengthValue->Int32Value()); | 596 V8TRYCATCH(uint32_t, sequenceLength, lengthValue->Int32Value()); |
| 596 length = sequenceLength; | 597 length = sequenceLength; |
| 597 | 598 |
| 598 return v8Value; | 599 return v8Value; |
| 599 } | 600 } |
| 600 | 601 |
| 602 inline DictionarySequence toDictionarySequence(v8::Handle<v8::Value> value,
int argumentIndex, v8::Isolate* isolate) |
| 603 { |
| 604 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(isolate, value)); |
| 605 uint32_t length = 0; |
| 606 if (value->IsArray()) { |
| 607 length = v8::Local<v8::Array>::Cast(v8Value)->Length(); |
| 608 } else if (toV8Sequence(value, length, isolate).IsEmpty()) { |
| 609 throwTypeError(ExceptionMessages::notAnArrayTypeArgumentOrValue(argu
mentIndex), isolate); |
| 610 return DictionarySequence(); |
| 611 } |
| 612 |
| 613 return DictionarySequence(v8::Local<v8::Object>::Cast(v8Value), length,
isolate); |
| 614 } |
| 615 |
| 601 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Isolate*); | 616 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Isolate*); |
| 602 | 617 |
| 603 inline bool isUndefinedOrNull(v8::Handle<v8::Value> value) | 618 inline bool isUndefinedOrNull(v8::Handle<v8::Value> value) |
| 604 { | 619 { |
| 605 return value->IsNull() || value->IsUndefined(); | 620 return value->IsNull() || value->IsUndefined(); |
| 606 } | 621 } |
| 607 | 622 |
| 608 // Returns true if the provided object is to be considered a 'host object',
as used in the | 623 // Returns true if the provided object is to be considered a 'host object',
as used in the |
| 609 // HTML5 structured clone algorithm. | 624 // HTML5 structured clone algorithm. |
| 610 inline bool isHostObject(v8::Handle<v8::Object> object) | 625 inline bool isHostObject(v8::Handle<v8::Object> object) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 727 |
| 713 v8::Isolate* mainThreadIsolate(); | 728 v8::Isolate* mainThreadIsolate(); |
| 714 v8::Isolate* toIsolate(ExecutionContext*); | 729 v8::Isolate* toIsolate(ExecutionContext*); |
| 715 v8::Isolate* toIsolate(Frame*); | 730 v8::Isolate* toIsolate(Frame*); |
| 716 | 731 |
| 717 // Can only be called by blink::initialize | 732 // Can only be called by blink::initialize |
| 718 void setMainThreadIsolate(v8::Isolate*); | 733 void setMainThreadIsolate(v8::Isolate*); |
| 719 } // namespace WebCore | 734 } // namespace WebCore |
| 720 | 735 |
| 721 #endif // V8Binding_h | 736 #endif // V8Binding_h |
| OLD | NEW |