Chromium Code Reviews| Index: Source/bindings/core/dart/DartUtilities.cpp |
| diff --git a/Source/bindings/core/dart/DartUtilities.cpp b/Source/bindings/core/dart/DartUtilities.cpp |
| index 002e40c2c5af8ab8493584bf239dfb293740ef12..c2da362071678c9394401997e83d065c4cf50b4f 100644 |
| --- a/Source/bindings/core/dart/DartUtilities.cpp |
| +++ b/Source/bindings/core/dart/DartUtilities.cpp |
| @@ -977,6 +977,16 @@ PassRefPtr<WTF::Float32Array> DartUtilities::dartToFloat32Array(Dart_NativeArgum |
| return dartToFloat32Array(object, exception); |
| } |
| +bool DartUtilities::isUint8Array(Dart_Handle object) |
| +{ |
| + return Dart_GetTypeOfTypedData(object) == Dart_TypedData_kUint8; |
| +} |
| + |
| +bool DartUtilities::isUint8ClampedArray(Dart_Handle object) |
| +{ |
| + return Dart_GetTypeOfTypedData(object) == Dart_TypedData_kUint8Clamped; |
|
siva
2014/10/22 01:13:03
Ditto question about
kExternalTypedDataUint8Clam
Leaf
2014/10/22 16:31:19
Sorry, what was the question?
On 2014/10/22 01:13
|
| +} |
| + |
| SQLValue DartUtilities::toSQLValue(Dart_Handle object, Dart_Handle& exception) |
| { |
| if (Dart_IsNull(object)) |
| @@ -1309,6 +1319,23 @@ void DartUtilities::reportProblem(ExecutionContext* context, Dart_Handle result, |
| } |
| } |
| +Dart_Handle DartUtilities::toDartCoreException(const String& className, const String& message) |
| +{ |
| + DartApiScope apiScope; |
| + DartDOMData* domData = DartDOMData::current(); |
| + Dart_Handle coreLib = Dart_LookupLibrary(Dart_NewStringFromCString("dart:core")); |
| + Dart_Handle errorClass = Dart_GetType(coreLib, stringToDart(className), 0, 0); |
|
siva
2014/10/22 01:13:03
You could use domData->coreLibrary() here instead
Leaf
2014/10/22 16:31:19
Great thanks, will change in followup.
On 2014/10
|
| + Dart_Handle dartMessage = stringToDart(message); |
| + Dart_Handle error = Dart_New(errorClass, Dart_NewStringFromCString(""), 1, &dartMessage); |
|
siva
2014/10/22 01:13:03
Dart_EmptyString() instead of creating another new
Leaf
2014/10/22 16:31:19
Acknowledged.
|
| + Dart_SetPersistentHandle(domData->currentException(), error); |
| + return domData->currentException(); |
| +} |
| + |
| +Dart_Handle DartUtilities::coreArgumentErrorException(const String& message) |
| +{ |
| + return DartUtilities::toDartCoreException("ArgumentError", message); |
| +} |
| + |
| Dart_Handle DartUtilities::notImplementedException(const char* fileName, int lineNumber) |
| { |
| Dart_Handle args[2] = { Dart_NewStringFromCString(fileName), Dart_NewInteger(lineNumber) }; |