| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 { | 49 { |
| 50 AudioContext* receiver = DartDOMWrapper::receiver< AudioContext >(args); | 50 AudioContext* receiver = DartDOMWrapper::receiver< AudioContext >(args); |
| 51 | 51 |
| 52 // The audio decoder retains the array buffer to operate on it | 52 // The audio decoder retains the array buffer to operate on it |
| 53 // in a different thread. Therefore, we make sure to | 53 // in a different thread. Therefore, we make sure to |
| 54 // externalize the audioData. | 54 // externalize the audioData. |
| 55 RefPtr<ArrayBuffer> audioData = DartUtilities::dartToExternalizedArrayBu
ffer(Dart_GetNativeArgument(args, 1), exception); | 55 RefPtr<ArrayBuffer> audioData = DartUtilities::dartToExternalizedArrayBu
ffer(Dart_GetNativeArgument(args, 1), exception); |
| 56 if (exception) | 56 if (exception) |
| 57 goto fail; | 57 goto fail; |
| 58 | 58 |
| 59 OwnPtr<AudioBufferCallback> successCallback = DartAudioBufferCallback::c
reate(Dart_GetNativeArgument(args, 2), exception); | 59 AudioBufferCallback* successCallback = DartAudioBufferCallback::create(D
art_GetNativeArgument(args, 2), exception); |
| 60 if (exception) | 60 if (exception) |
| 61 goto fail; | 61 goto fail; |
| 62 | 62 |
| 63 OwnPtr<AudioBufferCallback> errorCallback = DartAudioBufferCallback::cre
ateWithNullCheck(Dart_GetNativeArgument(args, 3), exception); | 63 AudioBufferCallback* errorCallback = DartAudioBufferCallback::createWith
NullCheck(Dart_GetNativeArgument(args, 3), exception); |
| 64 if (exception) | 64 if (exception) |
| 65 goto fail; | 65 goto fail; |
| 66 | 66 |
| 67 DartExceptionState es; | 67 DartExceptionState es; |
| 68 receiver->decodeAudioData(audioData.get(), successCallback.release(), er
rorCallback.release(), es); | 68 receiver->decodeAudioData(audioData.get(), successCallback, errorCallbac
k, es); |
| 69 if (es.hadException()) { | 69 if (es.hadException()) { |
| 70 exception = es.toDart(args); | 70 exception = es.toDart(args); |
| 71 goto fail; | 71 goto fail; |
| 72 } | 72 } |
| 73 return; | 73 return; |
| 74 } | 74 } |
| 75 | 75 |
| 76 fail: | 76 fail: |
| 77 Dart_ThrowException(exception); | 77 Dart_ThrowException(exception); |
| 78 ASSERT_NOT_REACHED(); | 78 ASSERT_NOT_REACHED(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 105 fail: | 105 fail: |
| 106 Dart_ThrowException(exception); | 106 Dart_ThrowException(exception); |
| 107 ASSERT_NOT_REACHED(); | 107 ASSERT_NOT_REACHED(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } | 110 } |
| 111 | 111 |
| 112 } | 112 } |
| 113 | 113 |
| 114 #endif // ENABLE(WEB_AUDIO) | 114 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |