OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // that the context has been closed. | 308 // that the context has been closed. |
309 setContextState(Closed); | 309 setContextState(Closed); |
310 | 310 |
311 AudioBuffer* renderedBuffer = renderTarget(); | 311 AudioBuffer* renderedBuffer = renderTarget(); |
312 | 312 |
313 ASSERT(renderedBuffer); | 313 ASSERT(renderedBuffer); |
314 if (!renderedBuffer) | 314 if (!renderedBuffer) |
315 return; | 315 return; |
316 | 316 |
317 // Avoid firing the event if the document has already gone away. | 317 // Avoid firing the event if the document has already gone away. |
318 if (executionContext()) { | 318 if (getExecutionContext()) { |
319 // Call the offline rendering completion event listener and resolve the | 319 // Call the offline rendering completion event listener and resolve the |
320 // promise too. | 320 // promise too. |
321 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); | 321 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); |
322 m_completeResolver->resolve(renderedBuffer); | 322 m_completeResolver->resolve(renderedBuffer); |
323 } else { | 323 } else { |
324 // The resolver should be rejected when the execution context is gone. | 324 // The resolver should be rejected when the execution context is gone. |
325 m_completeResolver->reject(DOMException::create(InvalidStateError, | 325 m_completeResolver->reject(DOMException::create(InvalidStateError, |
326 "the execution context does not exist")); | 326 "the execution context does not exist")); |
327 } | 327 } |
328 } | 328 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Note that the GraphLock is required before this check. Since this needs | 389 // Note that the GraphLock is required before this check. Since this needs |
390 // to run on the audio thread, OfflineGraphAutoLocker must be used. | 390 // to run on the audio thread, OfflineGraphAutoLocker must be used. |
391 if (m_scheduledSuspends.contains(currentSampleFrame())) | 391 if (m_scheduledSuspends.contains(currentSampleFrame())) |
392 return true; | 392 return true; |
393 | 393 |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 } // namespace blink | 397 } // namespace blink |
398 | 398 |
OLD | NEW |