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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return false; | 388 return false; |
389 } | 389 } |
390 | 390 |
391 Dart_Handle exception = 0; | 391 Dart_Handle exception = 0; |
392 bool boolResult = dartToBool(result, exception); | 392 bool boolResult = dartToBool(result, exception); |
393 if (exception) | 393 if (exception) |
394 return false; | 394 return false; |
395 return boolResult; | 395 return boolResult; |
396 } | 396 } |
397 | 397 |
398 bool DartUtilities::isTypeSubclassOfTag(Dart_Handle type, const String& tagName) | 398 Dart_Handle DartUtilities::getAndValidateNativeType(Dart_Handle type, const Stri
ng& tagName) |
399 { | 399 { |
400 Dart_Handle args[2] = { type, stringToDartString(tagName) }; | 400 Dart_Handle args[2] = { type, stringToDartString(tagName) }; |
401 Dart_Handle result = DartUtilities::invokeUtilsMethod("isTypeSubclassOfTag",
2, args); | 401 Dart_Handle result = DartUtilities::invokeUtilsMethod("getAndValidateNativeT
ype", 2, args); |
402 ASSERT(!Dart_IsError(result)); | 402 ASSERT(!Dart_IsError(result)); |
403 if (Dart_IsError(result)) { | 403 if (Dart_IsError(result)) { |
404 ASSERT_NOT_REACHED(); | 404 ASSERT_NOT_REACHED(); |
405 return false; | 405 return Dart_Null(); |
406 } | 406 } |
407 | 407 return result; |
408 Dart_Handle exception = 0; | |
409 bool boolResult = dartToBool(result, exception); | |
410 if (exception) | |
411 return false; | |
412 return boolResult; | |
413 } | 408 } |
414 | 409 |
415 bool DartUtilities::isTypedData(Dart_Handle handle) | 410 bool DartUtilities::isTypedData(Dart_Handle handle) |
416 { | 411 { |
417 return (Dart_GetTypeOfTypedData(handle) != Dart_TypedData_kInvalid) | 412 return (Dart_GetTypeOfTypedData(handle) != Dart_TypedData_kInvalid) |
418 || (Dart_GetTypeOfExternalTypedData(handle) != Dart_TypedData_kInvalid); | 413 || (Dart_GetTypeOfExternalTypedData(handle) != Dart_TypedData_kInvalid); |
419 } | 414 } |
420 | 415 |
421 static Dart_TypedData_Type typedDataTypeFromViewType(ArrayBufferView::ViewType t
ype) | 416 static Dart_TypedData_Type typedDataTypeFromViewType(ArrayBufferView::ViewType t
ype) |
422 { | 417 { |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 Dart_PersistentHandle library = domData->htmlLibrary(); | 1085 Dart_PersistentHandle library = domData->htmlLibrary(); |
1091 ASSERT(!Dart_IsError(library)); | 1086 ASSERT(!Dart_IsError(library)); |
1092 | 1087 |
1093 Dart_Handle utilsClass = Dart_GetType(library, Dart_NewStringFromCString("_U
tils"), 0, 0); | 1088 Dart_Handle utilsClass = Dart_GetType(library, Dart_NewStringFromCString("_U
tils"), 0, 0); |
1094 ASSERT(!Dart_IsError(utilsClass)); | 1089 ASSERT(!Dart_IsError(utilsClass)); |
1095 | 1090 |
1096 return Dart_Invoke(utilsClass, Dart_NewStringFromCString(methodName), argCou
nt, args); | 1091 return Dart_Invoke(utilsClass, Dart_NewStringFromCString(methodName), argCou
nt, args); |
1097 } | 1092 } |
1098 | 1093 |
1099 } | 1094 } |
OLD | NEW |