| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); | 74 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); |
| 75 for (uint32_t i = 0; i < length; ++i) { | 75 for (uint32_t i = 0; i < length; ++i) { |
| 76 Dart_Handle item = blobParts[i]; | 76 Dart_Handle item = blobParts[i]; |
| 77 if (DartUtilities::isTypedData(item)) { | 77 if (DartUtilities::isTypedData(item)) { |
| 78 RefPtr<ArrayBuffer> arrayBuffer = DartUtilities::dartToArrayBuff
er(item, exception); | 78 RefPtr<ArrayBuffer> arrayBuffer = DartUtilities::dartToArrayBuff
er(item, exception); |
| 79 if (exception) | 79 if (exception) |
| 80 goto fail; | 80 goto fail; |
| 81 ASSERT(arrayBuffer); | 81 ASSERT(arrayBuffer); |
| 82 blobBuilder.append(arrayBuffer.get()); | 82 blobBuilder.append(arrayBuffer.get()); |
| 83 } else if (DartDOMWrapper::instanceOf<DartBlob>(domData, item)) { | 83 } else if (DartDOMWrapper::subtypeOf<DartBlob>(domData, item)) { |
| 84 Blob* blob = DartBlob::toNative(item, exception); | 84 Blob* blob = DartBlob::toNative(item, exception); |
| 85 if (exception) | 85 if (exception) |
| 86 goto fail; | 86 goto fail; |
| 87 ASSERT(blob); | 87 ASSERT(blob); |
| 88 blobBuilder.append(blob); | 88 blobBuilder.append(blob); |
| 89 } else { | 89 } else { |
| 90 String stringValue = DartUtilities::dartToString(item, exception
); | 90 String stringValue = DartUtilities::dartToString(item, exception
); |
| 91 if (exception) | 91 if (exception) |
| 92 goto fail; | 92 goto fail; |
| 93 blobBuilder.append(stringValue, endings); | 93 blobBuilder.append(stringValue, endings); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 111 if (!blob) | 111 if (!blob) |
| 112 return Dart_Null(); | 112 return Dart_Null(); |
| 113 | 113 |
| 114 if (blob->isFile()) | 114 if (blob->isFile()) |
| 115 return DartFile::createWrapper(static_cast<File*>(blob)); | 115 return DartFile::createWrapper(static_cast<File*>(blob)); |
| 116 | 116 |
| 117 return DartDOMWrapper::createWrapper<DartBlob>(blob); | 117 return DartDOMWrapper::createWrapper<DartBlob>(blob); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } | 120 } |
| OLD | NEW |