Title: [244860] trunk/Source/WebCore
Revision
244860
Author
[email protected]
Date
2019-05-01 17:20:38 -0700 (Wed, 01 May 2019)

Log Message

Add back hasNullReferences() assert in Document::updateIsPlayingMedia
https://bugs.webkit.org/show_bug.cgi?id=197477

Reviewed by Eric Carlson.

AudioContext had a special scriptExecutionContext() getter
that was returning nullptr when AudioContext is stopped.
Instead, make this getter behave as all other scriptExecutionContext() getters
and make sure existing call sites of the getter are fine with the change.

Covered by existing tests.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
No need to check whether offline since this constructor is for non offline AudioContext.
(WebCore::AudioContext::scriptExecutionContext const):
(WebCore::AudioContext::fireCompletionEvent):
* dom/Document.cpp:
(WebCore::Document::updateIsPlayingMedia):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244859 => 244860)


--- trunk/Source/WebCore/ChangeLog	2019-05-02 00:09:50 UTC (rev 244859)
+++ trunk/Source/WebCore/ChangeLog	2019-05-02 00:20:38 UTC (rev 244860)
@@ -1,3 +1,25 @@
+2019-05-01  Youenn Fablet  <[email protected]>
+
+        Add back hasNullReferences() assert in Document::updateIsPlayingMedia
+        https://bugs.webkit.org/show_bug.cgi?id=197477
+
+        Reviewed by Eric Carlson.
+
+        AudioContext had a special scriptExecutionContext() getter
+        that was returning nullptr when AudioContext is stopped.
+        Instead, make this getter behave as all other scriptExecutionContext() getters
+        and make sure existing call sites of the getter are fine with the change.
+
+        Covered by existing tests.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::AudioContext):
+        No need to check whether offline since this constructor is for non offline AudioContext.
+        (WebCore::AudioContext::scriptExecutionContext const):
+        (WebCore::AudioContext::fireCompletionEvent):
+        * dom/Document.cpp:
+        (WebCore::Document::updateIsPlayingMedia):
+
 2019-05-01  Justin Fan  <[email protected]>
 
         Update WebGPU class names based on sketch.idl

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (244859 => 244860)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2019-05-02 00:09:50 UTC (rev 244859)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2019-05-02 00:20:38 UTC (rev 244860)
@@ -148,10 +148,8 @@
     // Initialize the destination node's muted state to match the page's current muted state.
     pageMutedStateDidChange();
 
-    if (!isOfflineContext()) {
-        document.addAudioProducer(*this);
-        document.registerForVisibilityStateChangedCallbacks(*this);
-    }
+    document.addAudioProducer(*this);
+    document.registerForVisibilityStateChangedCallbacks(*this);
 }
 
 // Constructor for offline (non-realtime) rendering.
@@ -1067,7 +1065,7 @@
 
 ScriptExecutionContext* AudioContext::scriptExecutionContext() const
 {
-    return m_isStopScheduled ? 0 : ActiveDOMObject::scriptExecutionContext();
+    return ActiveDOMObject::scriptExecutionContext();
 }
 
 void AudioContext::nodeWillBeginPlayback()
@@ -1186,7 +1184,7 @@
         return;
 
     // Avoid firing the event if the document has already gone away.
-    if (scriptExecutionContext()) {
+    if (!m_isStopScheduled) {
         // Call the offline rendering completion event listener.
         m_eventQueue->enqueueEvent(OfflineAudioCompletionEvent::create(renderedBuffer));
     }

Modified: trunk/Source/WebCore/dom/Document.cpp (244859 => 244860)


--- trunk/Source/WebCore/dom/Document.cpp	2019-05-02 00:09:50 UTC (rev 244859)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-05-02 00:20:38 UTC (rev 244860)
@@ -3925,6 +3925,7 @@
 
 void Document::updateIsPlayingMedia(uint64_t sourceElementID)
 {
+    ASSERT(!m_audioProducers.hasNullReferences());
     MediaProducer::MediaStateFlags state = MediaProducer::IsNotPlaying;
     for (auto& audioProducer : m_audioProducers)
         state |= audioProducer.mediaState();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to