OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // | 76 // |
77 // We also want to avoid notifying the main thread if AudioContext does not | 77 // We also want to avoid notifying the main thread if AudioContext does not |
78 // exist any more. | 78 // exist any more. |
79 if (context) { | 79 if (context) { |
80 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( | 80 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( |
81 BLINK_FROM_HERE, | 81 BLINK_FROM_HERE, |
82 CrossThreadBind(&AsyncAudioDecoder::NotifyComplete, | 82 CrossThreadBind(&AsyncAudioDecoder::NotifyComplete, |
83 WrapCrossThreadPersistent(audio_data), | 83 WrapCrossThreadPersistent(audio_data), |
84 WrapCrossThreadPersistent(success_callback), | 84 WrapCrossThreadPersistent(success_callback), |
85 WrapCrossThreadPersistent(error_callback), | 85 WrapCrossThreadPersistent(error_callback), |
86 bus.Release(), WrapCrossThreadPersistent(resolver), | 86 std::move(bus), WrapCrossThreadPersistent(resolver), |
87 WrapCrossThreadPersistent(context))); | 87 WrapCrossThreadPersistent(context))); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void AsyncAudioDecoder::NotifyComplete(DOMArrayBuffer*, | 91 void AsyncAudioDecoder::NotifyComplete(DOMArrayBuffer*, |
92 AudioBufferCallback* success_callback, | 92 AudioBufferCallback* success_callback, |
93 AudioBufferCallback* error_callback, | 93 AudioBufferCallback* error_callback, |
94 AudioBus* audio_bus, | 94 AudioBus* audio_bus, |
95 ScriptPromiseResolver* resolver, | 95 ScriptPromiseResolver* resolver, |
96 BaseAudioContext* context) { | 96 BaseAudioContext* context) { |
97 DCHECK(IsMainThread()); | 97 DCHECK(IsMainThread()); |
98 | 98 |
99 AudioBuffer* audio_buffer = AudioBuffer::CreateFromAudioBus(audio_bus); | 99 AudioBuffer* audio_buffer = AudioBuffer::CreateFromAudioBus(audio_bus); |
100 | 100 |
101 // If the context is available, let the context finish the notification. | 101 // If the context is available, let the context finish the notification. |
102 if (context) { | 102 if (context) { |
103 context->HandleDecodeAudioData(audio_buffer, resolver, success_callback, | 103 context->HandleDecodeAudioData(audio_buffer, resolver, success_callback, |
104 error_callback); | 104 error_callback); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 } // namespace blink | 108 } // namespace blink |
OLD | NEW |