| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 operator AtomicString() const { return AtomicString(m_stringImpl); } | 72 operator AtomicString() const { return AtomicString(m_stringImpl); } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 RefPtr<StringImpl> m_stringImpl; | 75 RefPtr<StringImpl> m_stringImpl; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 class DartUtilities { | 78 class DartUtilities { |
| 79 public: | 79 public: |
| 80 static const char* htmlLibraryName; | 80 static const char* htmlLibraryName; |
| 81 static const char* indexedDBLibraryName; | 81 static const char* indexedDBLibraryName; |
| 82 static const char* svgLibraryName; |
| 82 | 83 |
| 83 static Dart_Handle stringImplToDartString(StringImpl*); | 84 static Dart_Handle stringImplToDartString(StringImpl*); |
| 84 static Dart_Handle stringToDartString(const String&); | 85 static Dart_Handle stringToDartString(const String&); |
| 85 static Dart_Handle stringToDartString(const AtomicString&); | 86 static Dart_Handle stringToDartString(const AtomicString&); |
| 86 | 87 |
| 87 static Dart_Handle errorToException(Dart_Handle error) | 88 static Dart_Handle errorToException(Dart_Handle error) |
| 88 { | 89 { |
| 89 ASSERT(Dart_IsError(error)); | 90 ASSERT(Dart_IsError(error)); |
| 90 if (Dart_ErrorHasException(error)) | 91 if (Dart_ErrorHasException(error)) |
| 91 return Dart_ErrorGetException(error); | 92 return Dart_ErrorGetException(error); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 static PassRefPtr<SerializedScriptValue> dartToSerializedScriptValue(Dart_Ha
ndle, Dart_Handle& exception); | 468 static PassRefPtr<SerializedScriptValue> dartToSerializedScriptValue(Dart_Ha
ndle, Dart_Handle& exception); |
| 468 static Dart_Handle serializedScriptValueToDart(PassRefPtr<SerializedScriptVa
lue>); | 469 static Dart_Handle serializedScriptValueToDart(PassRefPtr<SerializedScriptVa
lue>); |
| 469 | 470 |
| 470 static Dart_Handle dateToDart(double); | 471 static Dart_Handle dateToDart(double); |
| 471 static double dartToDate(Dart_Handle, Dart_Handle&); | 472 static double dartToDate(Dart_Handle, Dart_Handle&); |
| 472 static double dartToDate(Dart_NativeArguments args, int idx, Dart_Handle&); | 473 static double dartToDate(Dart_NativeArguments args, int idx, Dart_Handle&); |
| 473 static bool isDateTime(Dart_Handle); | 474 static bool isDateTime(Dart_Handle); |
| 474 static bool isBlob(Dart_Handle); | 475 static bool isBlob(Dart_Handle); |
| 475 static bool isImageData(Dart_Handle); | 476 static bool isImageData(Dart_Handle); |
| 476 static bool isIDBKeyRange(Dart_Handle); | 477 static bool isIDBKeyRange(Dart_Handle); |
| 478 static bool objectIsType(Dart_Handle, const char* libraryName, const char* t
ypeName); |
| 479 static bool isTypeSubclassOf(Dart_Handle type, const char* libraryName, cons
t char* typeName); |
| 477 | 480 |
| 478 static bool isTypedData(Dart_Handle); | 481 static bool isTypedData(Dart_Handle); |
| 479 | 482 |
| 480 static Dart_Handle arrayBufferToDart(WTF::ArrayBuffer*); | 483 static Dart_Handle arrayBufferToDart(WTF::ArrayBuffer*); |
| 481 static Dart_Handle arrayBufferToDart(PassRefPtr<WTF::ArrayBuffer> value) | 484 static Dart_Handle arrayBufferToDart(PassRefPtr<WTF::ArrayBuffer> value) |
| 482 { | 485 { |
| 483 return arrayBufferToDart(value.get()); | 486 return arrayBufferToDart(value.get()); |
| 484 } | 487 } |
| 485 | 488 |
| 486 static Dart_Handle arrayBufferViewToDart(WTF::ArrayBufferView*); | 489 static Dart_Handle arrayBufferViewToDart(WTF::ArrayBufferView*); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 static PassRefPtr<WTF::Int32Array> dartToInt32Array(Dart_NativeArguments arg
s, int idx, Dart_Handle& exception); | 541 static PassRefPtr<WTF::Int32Array> dartToInt32Array(Dart_NativeArguments arg
s, int idx, Dart_Handle& exception); |
| 539 static PassRefPtr<WTF::Uint8Array> dartToUint8Array(Dart_Handle, Dart_Handle
&); | 542 static PassRefPtr<WTF::Uint8Array> dartToUint8Array(Dart_Handle, Dart_Handle
&); |
| 540 static PassRefPtr<WTF::Uint8Array> dartToUint8Array(Dart_NativeArguments arg
s, int idx, Dart_Handle& exception); | 543 static PassRefPtr<WTF::Uint8Array> dartToUint8Array(Dart_NativeArguments arg
s, int idx, Dart_Handle& exception); |
| 541 static PassRefPtr<WTF::Float32Array> dartToFloat32Array(Dart_Handle, Dart_Ha
ndle&); | 544 static PassRefPtr<WTF::Float32Array> dartToFloat32Array(Dart_Handle, Dart_Ha
ndle&); |
| 542 static PassRefPtr<WTF::Float32Array> dartToFloat32Array(Dart_NativeArguments
args, int idx, Dart_Handle& exception); | 545 static PassRefPtr<WTF::Float32Array> dartToFloat32Array(Dart_NativeArguments
args, int idx, Dart_Handle& exception); |
| 543 | 546 |
| 544 static v8::Local<v8::Context> currentV8Context(); | 547 static v8::Local<v8::Context> currentV8Context(); |
| 545 | 548 |
| 546 private: | 549 private: |
| 547 static PassRefPtr<StringImpl> toStringImpl(Dart_Handle, intptr_t charsize, i
ntptr_t strlength, Dart_Handle& exception); | 550 static PassRefPtr<StringImpl> toStringImpl(Dart_Handle, intptr_t charsize, i
ntptr_t strlength, Dart_Handle& exception); |
| 548 static bool objectIsType(Dart_Handle, const char* libraryName, const char* t
ypeName); | |
| 549 }; | 551 }; |
| 550 | 552 |
| 551 class DartIsolateScope { | 553 class DartIsolateScope { |
| 552 public: | 554 public: |
| 553 explicit DartIsolateScope(Dart_Isolate isolate) | 555 explicit DartIsolateScope(Dart_Isolate isolate) |
| 554 { | 556 { |
| 555 m_isolate = isolate; | 557 m_isolate = isolate; |
| 556 m_previousIsolate = Dart_CurrentIsolate(); | 558 m_previousIsolate = Dart_CurrentIsolate(); |
| 557 if (m_previousIsolate != m_isolate) { | 559 if (m_previousIsolate != m_isolate) { |
| 558 if (m_previousIsolate) | 560 if (m_previousIsolate) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 643 } |
| 642 }; | 644 }; |
| 643 | 645 |
| 644 | 646 |
| 645 #define DART_UNIMPLEMENTED_EXCEPTION() DartUtilities::notImplementedException(__
FILE__, __LINE__) | 647 #define DART_UNIMPLEMENTED_EXCEPTION() DartUtilities::notImplementedException(__
FILE__, __LINE__) |
| 646 #define DART_UNIMPLEMENTED() Dart_ThrowException(DART_UNIMPLEMENTED_EXCEPTION())
; | 648 #define DART_UNIMPLEMENTED() Dart_ThrowException(DART_UNIMPLEMENTED_EXCEPTION())
; |
| 647 | 649 |
| 648 } // namespace WebCore | 650 } // namespace WebCore |
| 649 | 651 |
| 650 #endif // DartUtilities_h | 652 #endif // DartUtilities_h |
| OLD | NEW |