Title: [265173] trunk/Source/WebCore
Revision
265173
Author
[email protected]
Date
2020-07-31 23:09:15 -0700 (Fri, 31 Jul 2020)

Log Message

[Mac] AudioSessionRoutingArbitrator causes a launch time regression checking for CoreAudio muted state
https://bugs.webkit.org/show_bug.cgi?id=214993

Reviewed by Eric Carlson.

The initial query of isMuted() is only there to tell whether, when we get a notification that the mute state
changed, whether our internal state is dirty and we need to fire a notification. Instead, replace the bool member
with an Optional<bool>, so we know we need to fire a changed notification whenever the first mute state change
comes in.

* platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSession::AudioSession):
(WebCore::AudioSession::handleMutedStateChange):
(WebCore::AudioSessionPrivate::AudioSessionPrivate): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265172 => 265173)


--- trunk/Source/WebCore/ChangeLog	2020-08-01 05:57:38 UTC (rev 265172)
+++ trunk/Source/WebCore/ChangeLog	2020-08-01 06:09:15 UTC (rev 265173)
@@ -1,5 +1,22 @@
 2020-07-31  Jer Noble  <[email protected]>
 
+        [Mac] AudioSessionRoutingArbitrator causes a launch time regression checking for CoreAudio muted state
+        https://bugs.webkit.org/show_bug.cgi?id=214993
+
+        Reviewed by Eric Carlson.
+
+        The initial query of isMuted() is only there to tell whether, when we get a notification that the mute state
+        changed, whether our internal state is dirty and we need to fire a notification. Instead, replace the bool member
+        with an Optional<bool>, so we know we need to fire a changed notification whenever the first mute state change
+        comes in.
+
+        * platform/audio/mac/AudioSessionMac.mm:
+        (WebCore::AudioSession::AudioSession):
+        (WebCore::AudioSession::handleMutedStateChange):
+        (WebCore::AudioSessionPrivate::AudioSessionPrivate): Deleted.
+
+2020-07-31  Jer Noble  <[email protected]>
+
         Unreviewed Windows build fix after r265167; add some missing includes.
 
         * page/Screen.cpp:

Modified: trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm (265172 => 265173)


--- trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm	2020-08-01 05:57:38 UTC (rev 265172)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm	2020-08-01 06:09:15 UTC (rev 265173)
@@ -57,9 +57,8 @@
 class AudioSessionPrivate {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit AudioSessionPrivate(bool mutedState)
-        : lastMutedState(mutedState) { }
-    bool lastMutedState;
+    explicit AudioSessionPrivate() = default;
+    Optional<bool> lastMutedState;
     AudioSession::CategoryType category { AudioSession::None };
 #if ENABLE(ROUTING_ARBITRATION)
     bool setupArbitrationOngoing { false };
@@ -69,7 +68,7 @@
 };
 
 AudioSession::AudioSession()
-    : m_private(makeUnique<AudioSessionPrivate>(isMuted()))
+    : m_private(makeUnique<AudioSessionPrivate>())
 {
 }
 
@@ -275,7 +274,7 @@
         return;
 
     bool isCurrentlyMuted = isMuted();
-    if (m_private->lastMutedState == isCurrentlyMuted)
+    if (m_private->lastMutedState && *m_private->lastMutedState == isCurrentlyMuted)
         return;
 
     for (auto* observer : m_observers)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to