| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); | 48 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); |
| 49 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1); | 49 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1); |
| 50 | 50 |
| 51 DartExceptionState es; | 51 DartExceptionState es; |
| 52 if (DartUtilities::isTypedData(dataHandle)) { | 52 if (DartUtilities::isTypedData(dataHandle)) { |
| 53 RefPtr<ArrayBuffer> data = DartUtilities::dartToArrayBuffer(dataHand
le, exception); | 53 RefPtr<ArrayBuffer> data = DartUtilities::dartToArrayBuffer(dataHand
le, exception); |
| 54 if (exception) | 54 if (exception) |
| 55 goto fail; | 55 goto fail; |
| 56 receiver->send(data.get(), es); | 56 receiver->send(data.get(), es); |
| 57 } else if (DartDOMWrapper::instanceOf<DartBlob>(domData, dataHandle)) { | 57 } else if (DartDOMWrapper::subtypeOf<DartBlob>(domData, dataHandle)) { |
| 58 Blob* data = DartBlob::toNative(dataHandle, exception); | 58 Blob* data = DartBlob::toNative(dataHandle, exception); |
| 59 if (exception) | 59 if (exception) |
| 60 goto fail; | 60 goto fail; |
| 61 receiver->send(data, es); | 61 receiver->send(data, es); |
| 62 } else if (Dart_IsString(dataHandle)) { | 62 } else if (Dart_IsString(dataHandle)) { |
| 63 DartStringAdapter data = DartUtilities::dartToString(dataHandle, exc
eption); | 63 DartStringAdapter data = DartUtilities::dartToString(dataHandle, exc
eption); |
| 64 if (exception) | 64 if (exception) |
| 65 goto fail; | 65 goto fail; |
| 66 receiver->send(data, es); | 66 receiver->send(data, es); |
| 67 } else { | 67 } else { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 fail: | 183 fail: |
| 184 Dart_ThrowException(exception); | 184 Dart_ThrowException(exception); |
| 185 ASSERT_NOT_REACHED(); | 185 ASSERT_NOT_REACHED(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } | 188 } |
| 189 | 189 |
| 190 } | 190 } |
| OLD | NEW |