| Index: Source/bindings/dart/DartUtilities.cpp
|
| diff --git a/Source/bindings/dart/DartUtilities.cpp b/Source/bindings/dart/DartUtilities.cpp
|
| index 04eadb97724e6c11a5924d0486bf0671123335f9..51cf72f5c492f7645c9998f812c2fa66ff54d586 100644
|
| --- a/Source/bindings/dart/DartUtilities.cpp
|
| +++ b/Source/bindings/dart/DartUtilities.cpp
|
| @@ -30,6 +30,9 @@
|
| #include "config.h"
|
| #include "bindings/dart/DartUtilities.h"
|
|
|
| +#include "DartBlob.h"
|
| +#include "DartIDBKeyRange.h"
|
| +#include "DartImageData.h"
|
| #include "DartMessagePort.h"
|
| #include "bindings/dart/DartDOMData.h"
|
| #include "bindings/dart/DartHandleProxy.h"
|
| @@ -65,6 +68,7 @@ namespace WebCore {
|
|
|
| const char* DartUtilities::htmlLibraryName = "dart:html";
|
| const char* DartUtilities::indexedDBLibraryName = "dart:indexed_db";
|
| +const char* DartUtilities::svgLibraryName = "dart:svg";
|
|
|
| static void stringFinalizer(void* peer)
|
| {
|
| @@ -345,17 +349,28 @@ bool DartUtilities::isDateTime(Dart_Handle handle)
|
|
|
| bool DartUtilities::isBlob(Dart_Handle handle)
|
| {
|
| - return objectIsType(handle, htmlLibraryName, "Blob");
|
| + return objectIsType(handle, DartDOMWrapper::dartClass<DartBlob>());
|
| }
|
|
|
| bool DartUtilities::isImageData(Dart_Handle handle)
|
| {
|
| - return objectIsType(handle, htmlLibraryName, "ImageData");
|
| + return objectIsType(handle, DartDOMWrapper::dartClass<DartImageData>());
|
| }
|
|
|
| bool DartUtilities::isIDBKeyRange(Dart_Handle handle)
|
| {
|
| - return objectIsType(handle, indexedDBLibraryName, "KeyRange");
|
| + return objectIsType(handle, DartDOMWrapper::dartClass<DartIDBKeyRange>());
|
| +}
|
| +
|
| +bool DartUtilities::objectIsType(Dart_Handle handle, Dart_Handle cls)
|
| +{
|
| + bool isType = false;
|
| + Dart_Handle result = Dart_ObjectIsType(handle, cls, &isType);
|
| + ASSERT(!Dart_IsError(result));
|
| + if (Dart_IsError(result))
|
| + return false;
|
| +
|
| + return isType;
|
| }
|
|
|
| bool DartUtilities::objectIsType(Dart_Handle handle, const char* libraryName, const char* typeName)
|
| @@ -367,13 +382,28 @@ bool DartUtilities::objectIsType(Dart_Handle handle, const char* libraryName, co
|
| Dart_Handle cls = Dart_GetClass(library, Dart_NewStringFromCString(typeName));
|
| ASSERT(!Dart_IsError(cls));
|
|
|
| - bool isType = false;
|
| - Dart_Handle result = Dart_ObjectIsType(handle, cls, &isType);
|
| + return objectIsType(handle, cls);
|
| +}
|
| +
|
| +bool DartUtilities::isTypeSubclassOf(Dart_Handle type, const char* libraryName, const char* typeName)
|
| +{
|
| + Dart_Handle library = libraryForCurrentIsolate(libraryName);
|
| + ASSERT(!Dart_IsError(library));
|
| +
|
| + Dart_Handle other = Dart_GetType(library, Dart_NewStringFromCString(typeName), 0, 0);
|
| + ASSERT(!Dart_IsError(other));
|
| +
|
| + Dart_Handle args[2] = { type, other };
|
| + Dart_Handle result = DartUtilities::invokeUtilsMethod("isTypeSubclassOf", 2, args);
|
| ASSERT(!Dart_IsError(result));
|
| if (Dart_IsError(result))
|
| return false;
|
|
|
| - return isType;
|
| + Dart_Handle exception = 0;
|
| + bool boolResult = dartToBool(result, exception);
|
| + if (exception)
|
| + return false;
|
| + return boolResult;
|
| }
|
|
|
| bool DartUtilities::isTypedData(Dart_Handle handle)
|
|
|