| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 bool AudioContext::isRunnable() const | 251 bool AudioContext::isRunnable() const |
| 252 { | 252 { |
| 253 if (!isInitialized()) | 253 if (!isInitialized()) |
| 254 return false; | 254 return false; |
| 255 | 255 |
| 256 // Check with the HRTF spatialization system to see if it's finished loading
. | 256 // Check with the HRTF spatialization system to see if it's finished loading
. |
| 257 return m_hrtfDatabaseLoader->isLoaded(); | 257 return m_hrtfDatabaseLoader->isLoaded(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void AudioContext::uninitializeDispatch(void* userData) |
| 261 { |
| 262 AudioContext* context = reinterpret_cast<AudioContext*>(userData); |
| 263 ASSERT(context); |
| 264 if (!context) |
| 265 return; |
| 266 |
| 267 context->uninitialize(); |
| 268 } |
| 269 |
| 260 void AudioContext::stop() | 270 void AudioContext::stop() |
| 261 { | 271 { |
| 262 m_document = 0; // document is going away | 272 m_document = 0; // document is going away |
| 263 uninitialize(); | 273 |
| 274 // Don't call uninitialize() immediately here because the ScriptExecutionCon
text is in the middle |
| 275 // of dealing with all of its ActiveDOMObjects at this point. uninitialize()
can de-reference other |
| 276 // ActiveDOMObjects so let's schedule uninitialize() to be called later. |
| 277 // FIXME: see if there's a more direct way to handle this issue. |
| 278 callOnMainThread(uninitializeDispatch, this); |
| 264 } | 279 } |
| 265 | 280 |
| 266 Document* AudioContext::document() const | 281 Document* AudioContext::document() const |
| 267 { | 282 { |
| 268 ASSERT(m_document); | 283 ASSERT(m_document); |
| 269 return m_document; | 284 return m_document; |
| 270 } | 285 } |
| 271 | 286 |
| 272 bool AudioContext::hasDocument() | 287 bool AudioContext::hasDocument() |
| 273 { | 288 { |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 // Avoid firing the event if the document has already gone away. | 762 // Avoid firing the event if the document has already gone away. |
| 748 if (hasDocument()) { | 763 if (hasDocument()) { |
| 749 // Call the offline rendering completion event listener. | 764 // Call the offline rendering completion event listener. |
| 750 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); | 765 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); |
| 751 } | 766 } |
| 752 } | 767 } |
| 753 | 768 |
| 754 } // namespace WebCore | 769 } // namespace WebCore |
| 755 | 770 |
| 756 #endif // ENABLE(WEB_AUDIO) | 771 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |