| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ASSERT(!m_isResolvingResumePromises); | 131 ASSERT(!m_isResolvingResumePromises); |
| 132 ASSERT(!m_resumeResolvers.size()); | 132 ASSERT(!m_resumeResolvers.size()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void AbstractAudioContext::initialize() | 135 void AbstractAudioContext::initialize() |
| 136 { | 136 { |
| 137 if (isDestinationInitialized()) | 137 if (isDestinationInitialized()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 FFTFrame::initialize(); | 140 FFTFrame::initialize(); |
| 141 m_listener = AudioListener::create(); | |
| 142 | 141 |
| 143 if (m_destinationNode.get()) { | 142 if (m_destinationNode.get()) { |
| 144 m_destinationNode->handler().initialize(); | 143 m_destinationNode->handler().initialize(); |
| 144 // The AudioParams in the listener need access to the destination node,
so only create the |
| 145 // listener if the destination node exists. |
| 146 m_listener = AudioListener::create(*this); |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 | 149 |
| 148 void AbstractAudioContext::clear() | 150 void AbstractAudioContext::clear() |
| 149 { | 151 { |
| 150 m_destinationNode.clear(); | 152 m_destinationNode.clear(); |
| 151 // The audio rendering thread is dead. Nobody will schedule AudioHandler | 153 // The audio rendering thread is dead. Nobody will schedule AudioHandler |
| 152 // deletion. Let's do it ourselves. | 154 // deletion. Let's do it ourselves. |
| 153 deferredTaskHandler().clearHandlersToBeDeleted(); | 155 deferredTaskHandler().clearHandlersToBeDeleted(); |
| 154 m_isCleared = true; | 156 m_isCleared = true; |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // At the beginning of every render quantum, try to update the internal rend
ering graph state (from main thread changes). | 828 // At the beginning of every render quantum, try to update the internal rend
ering graph state (from main thread changes). |
| 827 // It's OK if the tryLock() fails, we'll just take slightly longer to pick u
p the changes. | 829 // It's OK if the tryLock() fails, we'll just take slightly longer to pick u
p the changes. |
| 828 if (tryLock()) { | 830 if (tryLock()) { |
| 829 deferredTaskHandler().handleDeferredTasks(); | 831 deferredTaskHandler().handleDeferredTasks(); |
| 830 | 832 |
| 831 resolvePromisesForResume(); | 833 resolvePromisesForResume(); |
| 832 | 834 |
| 833 // Check to see if source nodes can be stopped because the end time has
passed. | 835 // Check to see if source nodes can be stopped because the end time has
passed. |
| 834 handleStoppableSourceNodes(); | 836 handleStoppableSourceNodes(); |
| 835 | 837 |
| 838 // Update the dirty state of the listener. |
| 839 listener()->updateState(); |
| 840 |
| 836 unlock(); | 841 unlock(); |
| 837 } | 842 } |
| 838 } | 843 } |
| 839 | 844 |
| 840 void AbstractAudioContext::handlePostRenderTasks() | 845 void AbstractAudioContext::handlePostRenderTasks() |
| 841 { | 846 { |
| 842 ASSERT(isAudioThread()); | 847 ASSERT(isAudioThread()); |
| 843 | 848 |
| 844 // Must use a tryLock() here too. Don't worry, the lock will very rarely be
contended and this method is called frequently. | 849 // Must use a tryLock() here too. Don't worry, the lock will very rarely be
contended and this method is called frequently. |
| 845 // The worst that can happen is that there will be some nodes which will tak
e slightly longer than usual to be deleted or removed | 850 // The worst that can happen is that there will be some nodes which will tak
e slightly longer than usual to be deleted or removed |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const | 967 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const |
| 963 { | 968 { |
| 964 if (getExecutionContext()) | 969 if (getExecutionContext()) |
| 965 return getExecutionContext()->getSecurityOrigin(); | 970 return getExecutionContext()->getSecurityOrigin(); |
| 966 | 971 |
| 967 return nullptr; | 972 return nullptr; |
| 968 } | 973 } |
| 969 | 974 |
| 970 } // namespace blink | 975 } // namespace blink |
| 971 | 976 |
| OLD | NEW |