Changeset 265173 in webkit


Ignore:
Timestamp:
Jul 31, 2020 11:09:15 PM (4 years ago)
Author:
jer.noble@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r265172 r265173  
     12020-07-31  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac] AudioSessionRoutingArbitrator causes a launch time regression checking for CoreAudio muted state
     4        https://bugs.webkit.org/show_bug.cgi?id=214993
     5
     6        Reviewed by Eric Carlson.
     7
     8        The initial query of isMuted() is only there to tell whether, when we get a notification that the mute state
     9        changed, whether our internal state is dirty and we need to fire a notification. Instead, replace the bool member
     10        with an Optional<bool>, so we know we need to fire a changed notification whenever the first mute state change
     11        comes in.
     12
     13        * platform/audio/mac/AudioSessionMac.mm:
     14        (WebCore::AudioSession::AudioSession):
     15        (WebCore::AudioSession::handleMutedStateChange):
     16        (WebCore::AudioSessionPrivate::AudioSessionPrivate): Deleted.
     17
    1182020-07-31  Jer Noble  <jer.noble@apple.com>
    219
  • trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm

    r263328 r265173  
    5858    WTF_MAKE_FAST_ALLOCATED;
    5959public:
    60     explicit AudioSessionPrivate(bool mutedState)
    61         : lastMutedState(mutedState) { }
    62     bool lastMutedState;
     60    explicit AudioSessionPrivate() = default;
     61    Optional<bool> lastMutedState;
    6362    AudioSession::CategoryType category { AudioSession::None };
    6463#if ENABLE(ROUTING_ARBITRATION)
     
    7069
    7170AudioSession::AudioSession()
    72     : m_private(makeUnique<AudioSessionPrivate>(isMuted()))
     71    : m_private(makeUnique<AudioSessionPrivate>())
    7372{
    7473}
     
    276275
    277276    bool isCurrentlyMuted = isMuted();
    278     if (m_private->lastMutedState == isCurrentlyMuted)
     277    if (m_private->lastMutedState && *m_private->lastMutedState == isCurrentlyMuted)
    279278        return;
    280279
Note: See TracChangeset for help on using the changeset viewer.