Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp

Issue 1820403002: Implement Automations for PannerNode and AutioListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test because CL for min/maxValue AudioParam landed Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ASSERT(!m_isResolvingResumePromises); 128 ASSERT(!m_isResolvingResumePromises);
129 ASSERT(!m_resumeResolvers.size()); 129 ASSERT(!m_resumeResolvers.size());
130 } 130 }
131 131
132 void AbstractAudioContext::initialize() 132 void AbstractAudioContext::initialize()
133 { 133 {
134 if (isDestinationInitialized()) 134 if (isDestinationInitialized())
135 return; 135 return;
136 136
137 FFTFrame::initialize(); 137 FFTFrame::initialize();
138 m_listener = AudioListener::create();
139 138
140 if (m_destinationNode) { 139 if (m_destinationNode) {
141 m_destinationNode->handler().initialize(); 140 m_destinationNode->handler().initialize();
141 // The AudioParams in the listener need access to the destination node, so only create the
142 // listener if the destination node exists.
143 m_listener = AudioListener::create(*this);
142 } 144 }
143 } 145 }
144 146
145 void AbstractAudioContext::clear() 147 void AbstractAudioContext::clear()
146 { 148 {
147 m_destinationNode.clear(); 149 m_destinationNode.clear();
148 // The audio rendering thread is dead. Nobody will schedule AudioHandler 150 // The audio rendering thread is dead. Nobody will schedule AudioHandler
149 // deletion. Let's do it ourselves. 151 // deletion. Let's do it ourselves.
150 deferredTaskHandler().clearHandlersToBeDeleted(); 152 deferredTaskHandler().clearHandlersToBeDeleted();
151 m_isCleared = true; 153 m_isCleared = true;
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 // At the beginning of every render quantum, try to update the internal rend ering graph state (from main thread changes). 850 // At the beginning of every render quantum, try to update the internal rend ering graph state (from main thread changes).
849 // It's OK if the tryLock() fails, we'll just take slightly longer to pick u p the changes. 851 // It's OK if the tryLock() fails, we'll just take slightly longer to pick u p the changes.
850 if (tryLock()) { 852 if (tryLock()) {
851 deferredTaskHandler().handleDeferredTasks(); 853 deferredTaskHandler().handleDeferredTasks();
852 854
853 resolvePromisesForResume(); 855 resolvePromisesForResume();
854 856
855 // Check to see if source nodes can be stopped because the end time has passed. 857 // Check to see if source nodes can be stopped because the end time has passed.
856 handleStoppableSourceNodes(); 858 handleStoppableSourceNodes();
857 859
860 // Update the dirty state of the listener.
861 listener()->updateState();
862
858 unlock(); 863 unlock();
859 } 864 }
860 } 865 }
861 866
862 void AbstractAudioContext::handlePostRenderTasks() 867 void AbstractAudioContext::handlePostRenderTasks()
863 { 868 {
864 ASSERT(isAudioThread()); 869 ASSERT(isAudioThread());
865 870
866 // Must use a tryLock() here too. Don't worry, the lock will very rarely be contended and this method is called frequently. 871 // Must use a tryLock() here too. Don't worry, the lock will very rarely be contended and this method is called frequently.
867 // 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 872 // 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 981
977 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const 982 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const
978 { 983 {
979 if (getExecutionContext()) 984 if (getExecutionContext())
980 return getExecutionContext()->getSecurityOrigin(); 985 return getExecutionContext()->getSecurityOrigin();
981 986
982 return nullptr; 987 return nullptr;
983 } 988 }
984 989
985 } // namespace blink 990 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698