[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
crogers at google.com
crogers at google.com
Wed Dec 22 14:59:34 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 35e8b1872619fd90ed96d2f5d74fb785f0266c87
Author: crogers at google.com <crogers at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 27 03:35:17 2010 +0000
2010-10-26 Chris Rogers <crogers at google.com>
Reviewed by Kenneth Russell.
AudioContext and AudioNode followup changes for AudioNodeInput/AudioNodeOutput thread safety
https://bugs.webkit.org/show_bug.cgi?id=47504
No new tests since audio API is not yet implemented.
* webaudio/AudioContext.cpp:
(WebCore::AudioContext::isAudioThread):
(WebCore::AudioContext::isGraphOwner):
(WebCore::AudioContext::handlePreRenderTasks):
(WebCore::AudioContext::handlePostRenderTasks):
(WebCore::AudioContext::deleteMarkedNodes):
(WebCore::AudioContext::markAudioNodeInputDirty):
(WebCore::AudioContext::markAudioNodeOutputDirty):
(WebCore::AudioContext::handleDirtyAudioNodeInputs):
(WebCore::AudioContext::handleDirtyAudioNodeOutputs):
* webaudio/AudioContext.h:
* webaudio/AudioNode.cpp:
* webaudio/AudioNode.h:
(WebCore::AudioNode::isMarkedForDeletion):
* webaudio/AudioNode.idl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 328acc0..b6a45a7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,31 @@
Reviewed by Kenneth Russell.
+ AudioContext and AudioNode followup changes for AudioNodeInput/AudioNodeOutput thread safety
+ https://bugs.webkit.org/show_bug.cgi?id=47504
+
+ No new tests since audio API is not yet implemented.
+
+ * webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::isAudioThread):
+ (WebCore::AudioContext::isGraphOwner):
+ (WebCore::AudioContext::handlePreRenderTasks):
+ (WebCore::AudioContext::handlePostRenderTasks):
+ (WebCore::AudioContext::deleteMarkedNodes):
+ (WebCore::AudioContext::markAudioNodeInputDirty):
+ (WebCore::AudioContext::markAudioNodeOutputDirty):
+ (WebCore::AudioContext::handleDirtyAudioNodeInputs):
+ (WebCore::AudioContext::handleDirtyAudioNodeOutputs):
+ * webaudio/AudioContext.h:
+ * webaudio/AudioNode.cpp:
+ * webaudio/AudioNode.h:
+ (WebCore::AudioNode::isMarkedForDeletion):
+ * webaudio/AudioNode.idl:
+
+2010-10-26 Chris Rogers <crogers at google.com>
+
+ Reviewed by Kenneth Russell.
+
Add DelayProcessor files
https://bugs.webkit.org/show_bug.cgi?id=47517
diff --git a/WebCore/webaudio/AudioContext.cpp b/WebCore/webaudio/AudioContext.cpp
index f971e6a..da7df1b 100644
--- a/WebCore/webaudio/AudioContext.cpp
+++ b/WebCore/webaudio/AudioContext.cpp
@@ -34,6 +34,8 @@
#include "AudioChannelSplitter.h"
#include "AudioGainNode.h"
#include "AudioListener.h"
+#include "AudioNodeInput.h"
+#include "AudioNodeOutput.h"
#include "AudioPannerNode.h"
#include "CachedAudio.h"
#include "ConvolverNode.h"
@@ -390,12 +392,12 @@ void AudioContext::unlock()
m_contextGraphMutex.unlock();
}
-bool AudioContext::isAudioThread()
+bool AudioContext::isAudioThread() const
{
return currentThread() == m_audioThread;
}
-bool AudioContext::isGraphOwner()
+bool AudioContext::isGraphOwner() const
{
return currentThread() == m_graphOwnerThread;
}
@@ -406,6 +408,23 @@ void AudioContext::addDeferredFinishDeref(AudioNode* node, AudioNode::RefType re
m_deferredFinishDerefList.append(AudioContext::RefInfo(node, refType));
}
+void AudioContext::handlePreRenderTasks()
+{
+ ASSERT(isAudioThread());
+
+ // At the beginning of every render quantum, try to update the internal rendering graph state (from main thread changes).
+ // It's OK if the tryLock() fails, we'll just take slightly longer to pick up the changes.
+ bool mustReleaseLock;
+ if (tryLock(mustReleaseLock)) {
+ // Fixup the state of any dirty AudioNodeInputs and AudioNodeOutputs.
+ handleDirtyAudioNodeInputs();
+ handleDirtyAudioNodeOutputs();
+
+ if (mustReleaseLock)
+ unlock();
+ }
+}
+
void AudioContext::handlePostRenderTasks()
{
ASSERT(isAudioThread());
@@ -424,6 +443,10 @@ void AudioContext::handlePostRenderTasks()
// Finally actually delete.
deleteMarkedNodes();
+ // Fixup the state of any dirty AudioNodeInputs and AudioNodeOutputs.
+ handleDirtyAudioNodeInputs();
+ handleDirtyAudioNodeOutputs();
+
if (mustReleaseLock)
unlock();
}
@@ -456,6 +479,18 @@ void AudioContext::deleteMarkedNodes()
while (size_t n = m_nodesToDelete.size()) {
AudioNode* node = m_nodesToDelete[n - 1];
m_nodesToDelete.removeLast();
+
+ // Before deleting the node, clear out any AudioNodeInputs from m_dirtyAudioNodeInputs.
+ unsigned numberOfInputs = node->numberOfInputs();
+ for (unsigned i = 0; i < numberOfInputs; ++i)
+ m_dirtyAudioNodeInputs.remove(node->input(i));
+
+ // Before deleting the node, clear out any AudioNodeOutputs from m_dirtyAudioNodeOutputs.
+ unsigned numberOfOutputs = node->numberOfOutputs();
+ for (unsigned i = 0; i < numberOfOutputs; ++i)
+ m_dirtyAudioNodeOutputs.remove(node->output(i));
+
+ // Finally, delete it.
delete node;
// Don't delete too many nodes per render quantum since we don't want to do too much work in the realtime audio thread.
@@ -464,6 +499,39 @@ void AudioContext::deleteMarkedNodes()
}
}
+void AudioContext::markAudioNodeInputDirty(AudioNodeInput* input)
+{
+ ASSERT(isGraphOwner());
+ m_dirtyAudioNodeInputs.add(input);
+}
+
+void AudioContext::markAudioNodeOutputDirty(AudioNodeOutput* output)
+{
+ ASSERT(isGraphOwner());
+ m_dirtyAudioNodeOutputs.add(output);
+}
+
+void AudioContext::handleDirtyAudioNodeInputs()
+{
+ ASSERT(isGraphOwner());
+
+ for (HashSet<AudioNodeInput*>::iterator i = m_dirtyAudioNodeInputs.begin(); i != m_dirtyAudioNodeInputs.end(); ++i)
+ (*i)->updateRenderingState();
+
+ m_dirtyAudioNodeInputs.clear();
+}
+
+void AudioContext::handleDirtyAudioNodeOutputs()
+{
+ ASSERT(isGraphOwner());
+
+ for (HashSet<AudioNodeOutput*>::iterator i = m_dirtyAudioNodeOutputs.begin(); i != m_dirtyAudioNodeOutputs.end(); ++i)
+ (*i)->updateRenderingState();
+
+ m_dirtyAudioNodeOutputs.clear();
+}
+
+
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/webaudio/AudioContext.h b/WebCore/webaudio/AudioContext.h
index 9fe1347..b79cd14 100644
--- a/WebCore/webaudio/AudioContext.h
+++ b/WebCore/webaudio/AudioContext.h
@@ -29,6 +29,7 @@
#include "AudioBus.h"
#include "AudioDestinationNode.h"
#include "HRTFDatabaseLoader.h"
+#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -107,6 +108,9 @@ public:
// When a source node has no more processing to do (has finished playing), then it tells the context to dereference it.
void notifyNodeFinishedProcessing(AudioNode*);
+ // Called at the start of each render quantum.
+ void handlePreRenderTasks();
+
// Called at the end of each render quantum.
void handlePostRenderTasks();
@@ -132,7 +136,7 @@ public:
void setAudioThread(ThreadIdentifier thread) { m_audioThread = thread; } // FIXME: check either not initialized or the same
ThreadIdentifier audioThread() const { return m_audioThread; }
- bool isAudioThread();
+ bool isAudioThread() const;
// Returns true only after the audio thread has been started and then shutdown.
bool isAudioThreadFinished() { return m_isAudioThreadFinished; }
@@ -147,7 +151,7 @@ public:
void unlock();
// Returns true if this thread owns the context's lock.
- bool isGraphOwner();
+ bool isGraphOwner() const;
class AutoLocker {
public:
@@ -173,6 +177,10 @@ public:
// In the audio thread at the start of each render cycle, we'll call handleDeferredFinishDerefs().
void handleDeferredFinishDerefs();
+
+ // Only accessed when the graph lock is held.
+ void markAudioNodeInputDirty(AudioNodeInput*);
+ void markAudioNodeOutputDirty(AudioNodeOutput*);
private:
AudioContext(Document*);
@@ -214,6 +222,12 @@ private:
Vector<AudioNode*> m_nodesToDelete;
Vector<RefPtr<CachedAudio> > m_cachedAudioReferences;
+
+ // Only accessed when the graph lock is held.
+ HashSet<AudioNodeInput*> m_dirtyAudioNodeInputs;
+ HashSet<AudioNodeOutput*> m_dirtyAudioNodeOutputs;
+ void handleDirtyAudioNodeInputs();
+ void handleDirtyAudioNodeOutputs();
OwnPtr<AudioBus> m_temporaryMonoBus;
OwnPtr<AudioBus> m_temporaryStereoBus;
diff --git a/WebCore/webaudio/AudioNode.cpp b/WebCore/webaudio/AudioNode.cpp
index 9335c10..18ddd3b 100644
--- a/WebCore/webaudio/AudioNode.cpp
+++ b/WebCore/webaudio/AudioNode.cpp
@@ -1,29 +1,25 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
diff --git a/WebCore/webaudio/AudioNode.h b/WebCore/webaudio/AudioNode.h
index 52f886d..069407d 100644
--- a/WebCore/webaudio/AudioNode.h
+++ b/WebCore/webaudio/AudioNode.h
@@ -1,29 +1,25 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AudioNode_h
@@ -134,6 +130,8 @@ public:
static void printNodeCounts();
#endif
+ bool isMarkedForDeletion() const { return m_isMarkedForDeletion; }
+
protected:
// Inputs and outputs must be created before the AudioNode is initialized.
void addInput(PassOwnPtr<AudioNodeInput>);
diff --git a/WebCore/webaudio/AudioNode.idl b/WebCore/webaudio/AudioNode.idl
index 5ed47cb..dad5454 100644
--- a/WebCore/webaudio/AudioNode.idl
+++ b/WebCore/webaudio/AudioNode.idl
@@ -1,29 +1,25 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module audio {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list