[Cocoa] Avoid creating a PlatformMediaSessionManager when the WebProcess is suspended...
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 19:32:03 +0000 (19:32 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 19:32:03 +0000 (19:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199160

Reviewed by Brent Fulgham.

When the WebProcess suspends or resumes, the PlatformMediaSessionManager is notified about this.
Avoid creating a new PlatformMediaSessionManager if it does not already exist.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::actualPrepareToSuspend):
(WebKit::WebProcess::cancelPrepareToSuspend):
(WebKit::WebProcess::processDidResume):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebProcess.cpp

index ceef29d..98ed8be 100644 (file)
@@ -1,3 +1,18 @@
+2019-06-24  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] Avoid creating a PlatformMediaSessionManager when the WebProcess is suspended or resumed
+        https://bugs.webkit.org/show_bug.cgi?id=199160
+
+        Reviewed by Brent Fulgham.
+
+        When the WebProcess suspends or resumes, the PlatformMediaSessionManager is notified about this.
+        Avoid creating a new PlatformMediaSessionManager if it does not already exist.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::actualPrepareToSuspend):
+        (WebKit::WebProcess::cancelPrepareToSuspend):
+        (WebKit::WebProcess::processDidResume):
+
 2019-06-24  Adrian Perez de Castro  <aperez@igalia.com>
 
         [WPE][GTK] Fixes for compilation with unified builds disabled
index a4bd7af..6069ea8 100644 (file)
@@ -1473,7 +1473,8 @@ void WebProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend shou
 
 #if ENABLE(VIDEO)
     suspendAllMediaBuffering();
-    PlatformMediaSessionManager::sharedManager().processWillSuspend();
+    if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
+        platformMediaSessionManager->processWillSuspend();
 #endif
 
     if (!m_suppressMemoryPressureHandler)
@@ -1535,7 +1536,8 @@ void WebProcess::cancelPrepareToSuspend()
 #endif
 
 #if ENABLE(VIDEO)
-    PlatformMediaSessionManager::sharedManager().processDidResume();
+    if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
+        platformMediaSessionManager->processDidResume();
     resumeAllMediaBuffering();
 #endif
 
@@ -1611,7 +1613,8 @@ void WebProcess::processDidResume()
 #endif
 
 #if ENABLE(VIDEO)
-    PlatformMediaSessionManager::sharedManager().processDidResume();
+    if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
+        platformMediaSessionManager->processDidResume();
     resumeAllMediaBuffering();
 #endif
 }