Changeset 247118 in webkit
- Timestamp:
- Jul 3, 2019 5:08:00 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247117 r247118 1 2019-07-03 Jer Noble <jer.noble@apple.com> 2 3 HTMLMediaElement can hold onto display sleep assertion while process is suspended. 4 https://bugs.webkit.org/show_bug.cgi?id=199471 5 <rdar://problem/52124320> 6 7 If the WebContent process is suspended before HTMLMediaElement gets a callback telling it 8 that the MediaPlayer has stopped playing, the SleepDisabler may stay set (and hold a display 9 or system sleep assertion) for the entire duration the process is suspended, causing excess 10 power drain. 11 12 Add a PlatformMediaSessionClient method (and an implementation in HTMLMediaElement) which will 13 be called during the preperation for process suspension, and in this callback, clear the 14 SleepDisabler token. 15 16 Reviewed by Eric Carlson. 17 18 * html/HTMLMediaElement.cpp: 19 (WebCore::HTMLMediaElement::shouldDisableSleep const): 20 (WebCore::HTMLMediaElement::processIsSuspendedChanged): 21 * html/HTMLMediaElement.h: 22 * platform/audio/PlatformMediaSession.h: 23 (WebCore::PlatformMediaSessionClient::processIsSuspendedChanged): 24 * platform/audio/PlatformMediaSessionManager.cpp: 25 (WebCore::PlatformMediaSessionManager::processWillSuspend): 26 (WebCore::PlatformMediaSessionManager::processDidResume): 27 * platform/audio/PlatformMediaSessionManager.h: 28 (WebCore::PlatformMediaSessionManager::processIsSuspended const): 29 1 30 2019-07-03 Jonathan Bedard <jbedard@apple.com> 2 31 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r246490 r247118 6924 6924 #endif 6925 6925 6926 if (PlatformMediaSessionManager::sharedManager().processIsSuspended()) 6927 return SleepType::None; 6928 6926 6929 bool shouldBeAbleToSleep = !hasVideo() || !hasAudio(); 6927 6930 #if ENABLE(MEDIA_STREAM) … … 7743 7746 return document().processingUserGestureForMedia(); 7744 7747 } 7748 7749 void HTMLMediaElement::processIsSuspendedChanged() 7750 { 7751 updateSleepDisabling(); 7752 } 7753 7745 7754 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 7746 7755 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r246490 r247118 895 895 bool processingUserGestureForMedia() const final; 896 896 bool hasMediaStreamSource() const final; 897 void processIsSuspendedChanged() final; 897 898 898 899 void pageMutedStateDidChange() override; -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.h
r245712 r247118 260 260 virtual bool hasMediaStreamSource() const { return false; } 261 261 262 virtual void processIsSuspendedChanged() { } 263 262 264 protected: 263 265 virtual ~PlatformMediaSessionClient() = default; -
trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
r245947 r247118 369 369 m_processIsSuspended = true; 370 370 371 forEachSession([&] (auto& session) { 372 session.client().processIsSuspendedChanged(); 373 }); 374 371 375 #if USE(AUDIO_SESSION) 372 376 if (m_becameActive && shouldDeactivateAudioSession()) { … … 384 388 m_processIsSuspended = false; 385 389 390 forEachSession([&] (auto& session) { 391 session.client().processIsSuspendedChanged(); 392 }); 393 386 394 #if USE(AUDIO_SESSION) 387 395 if (!m_becameActive && activeAudioSessionRequired()) { -
trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h
r245947 r247118 135 135 void forEachMatchingSession(const Function<bool(const PlatformMediaSession&)>& predicate, const Function<void(PlatformMediaSession&)>& matchingCallback); 136 136 137 bool processIsSuspended() const { return m_processIsSuspended; } 138 137 139 protected: 138 140 friend class PlatformMediaSession; … … 147 149 148 150 AudioHardwareListener* audioHardwareListener() { return m_audioHardwareListener.get(); } 149 150 bool processIsSuspended() const { return m_processIsSuspended; }151 151 152 152 #if !RELEASE_LOG_DISABLED
Note: See TracChangeset
for help on using the changeset viewer.