WebKit Bugzilla
Attachment 368511 Details for
Bug 197383
: Refactor AudioContext to register/unregister itself at construction/destruction time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197383-20190429162225.patch (text/plain), 3.58 KB, created by
youenn fablet
on 2019-04-29 16:22:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-04-29 16:22:27 PDT
Size:
3.58 KB
patch
obsolete
>Subversion Revision: 244694 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 83a5570adea3d55df64ea767b4b5aa71bb39ed4e..0f6028b5b909837d51c3cead3a84722be8079eec 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2019-04-29 Youenn Fablet <youenn@apple.com> >+ >+ Refactor AudioContext to register/unregister itself at construction/destruction time >+ https://bugs.webkit.org/show_bug.cgi?id=197383 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Registering/Unregistering is cheap. >+ Instead of registering/unregistering in initialize/uninitialize, >+ move this code to constructor/destructor. >+ No observable change of behavior. >+ >+ * Modules/webaudio/AudioContext.cpp: >+ (WebCore::AudioContext::AudioContext): >+ (WebCore::AudioContext::~AudioContext): >+ (WebCore::AudioContext::lazyInitialize): >+ (WebCore::AudioContext::uninitialize): >+ (WebCore::AudioContext::visibilityStateChanged): >+ > 2019-04-29 Youenn Fablet <youenn@apple.com> > > Make Document audio producers use WeakPtr >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.cpp b/Source/WebCore/Modules/webaudio/AudioContext.cpp >index 2e769e511964f96530ad690f3accf068d6788d97..9601a668fecd5db008d98324d5712e9999eb5762 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioContext.cpp >@@ -147,6 +147,11 @@ AudioContext::AudioContext(Document& document) > > // Initialize the destination node's muted state to match the page's current muted state. > pageMutedStateDidChange(); >+ >+ if (!isOfflineContext()) { >+ document.addAudioProducer(*this); >+ document.registerForVisibilityStateChangedCallbacks(*this); >+ } > } > > // Constructor for offline (non-realtime) rendering. >@@ -202,6 +207,11 @@ AudioContext::~AudioContext() > m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); > ASSERT(m_renderingAutomaticPullNodes.isEmpty()); > // FIXME: Can we assert that m_deferredFinishDerefList is empty? >+ >+ if (!isOfflineContext() && scriptExecutionContext()) { >+ document()->removeAudioProducer(*this); >+ document()->unregisterForVisibilityStateChangedCallbacks(*this); >+ } > } > > void AudioContext::lazyInitialize() >@@ -218,9 +228,6 @@ void AudioContext::lazyInitialize() > m_destinationNode->initialize(); > > if (!isOfflineContext()) { >- document()->addAudioProducer(*this); >- document()->registerForVisibilityStateChangedCallbacks(*this); >- > // This starts the audio thread. The destination node's provideInput() method will now be called repeatedly to render audio. > // Each time provideInput() is called, a portion of the audio stream is rendered. Let's call this time period a "render quantum". > // NOTE: for now default AudioContext does not need an explicit startRendering() call from JavaScript. >@@ -265,9 +272,6 @@ void AudioContext::uninitialize() > m_isAudioThreadFinished = true; > > if (!isOfflineContext()) { >- document()->removeAudioProducer(*this); >- document()->unregisterForVisibilityStateChangedCallbacks(*this); >- > ASSERT(s_hardwareContextCount); > --s_hardwareContextCount; > >@@ -378,7 +382,7 @@ bool AudioContext::isSuspended() const > void AudioContext::visibilityStateChanged() > { > // Do not suspend if audio is audible. >- if (mediaState() == MediaProducer::IsPlayingAudio) >+ if (mediaState() == MediaProducer::IsPlayingAudio || m_isStopScheduled) > return; > > if (document()->hidden()) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197383
:
368486
|
368489
| 368511