Title: [250367] branches/safari-608-branch/Source/WebKit
Revision
250367
Author
[email protected]
Date
2019-09-25 16:08:25 -0700 (Wed, 25 Sep 2019)

Log Message

Cherry-pick r250154. rdar://problem/55644650

    ApplicationStateTracker::m_isBackground initialization does not account for UIScenes
    https://bugs.webkit.org/show_bug.cgi?id=202048

    Reviewed by Geoffrey Garen.

    ApplicationStateTracker::m_isBackground initialization does not account for UIScenes, it merely checks
    the visibility state of the whole app. It should instead check the visibility state of the window's
    UIScene.

    This patch also refactors the code a little bit to reduce #ifdef'ing.

    * UIProcess/ApplicationStateTracker.mm:
    (WebKit::ApplicationStateTracker::ApplicationStateTracker):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250366 => 250367)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 23:08:20 UTC (rev 250366)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 23:08:25 UTC (rev 250367)
@@ -1,5 +1,41 @@
 2019-09-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r250154. rdar://problem/55644650
+
+    ApplicationStateTracker::m_isBackground initialization does not account for UIScenes
+    https://bugs.webkit.org/show_bug.cgi?id=202048
+    
+    Reviewed by Geoffrey Garen.
+    
+    ApplicationStateTracker::m_isBackground initialization does not account for UIScenes, it merely checks
+    the visibility state of the whole app. It should instead check the visibility state of the window's
+    UIScene.
+    
+    This patch also refactors the code a little bit to reduce #ifdef'ing.
+    
+    * UIProcess/ApplicationStateTracker.mm:
+    (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-20  Chris Dumez  <[email protected]>
+
+            ApplicationStateTracker::m_isBackground initialization does not account for UIScenes
+            https://bugs.webkit.org/show_bug.cgi?id=202048
+
+            Reviewed by Geoffrey Garen.
+
+            ApplicationStateTracker::m_isBackground initialization does not account for UIScenes, it merely checks
+            the visibility state of the whole app. It should instead check the visibility state of the window's
+            UIScene.
+
+            This patch also refactors the code a little bit to reduce #ifdef'ing.
+
+            * UIProcess/ApplicationStateTracker.mm:
+            (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+
+2019-09-25  Alan Coon  <[email protected]>
+
         Cherry-pick r250111. rdar://problem/55644650
 
     Add better logging for when the view visibility state changes

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm (250366 => 250367)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 23:08:20 UTC (rev 250366)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 23:08:25 UTC (rev 250367)
@@ -88,7 +88,7 @@
     ASSERT([m_view.get() respondsToSelector:m_willEnterForegroundSelector]);
 
     UIWindow *window = [m_view.get() window];
-    ASSERT(window);
+    RELEASE_ASSERT(window);
 
     NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
     UIApplication *application = [UIApplication sharedApplication];
@@ -104,28 +104,33 @@
 
     switch (applicationType(window)) {
     case ApplicationType::Application: {
-        m_isInBackground = application.applicationState == UIApplicationStateBackground;
-        RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
+#if HAVE(UISCENE)
+        m_isInBackground = window.windowScene.activationState == UISceneActivationStateBackground || window.windowScene.activationState == UISceneActivationStateUnattached;
+        RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
 
-#if HAVE(UISCENE)
         m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
+            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
+            applicationDidEnterBackground();
+        }];
+
+        m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
+            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
+            applicationWillEnterForeground();
+        }];
 #else
+        m_isInBackground = application.applicationState == UIApplicationStateBackground;
+        RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
+
         m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification object:application queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UIApplicationDidEnterBackground", this);
-#endif
+            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UIApplicationDidEnterBackground", this);
             applicationDidEnterBackground();
         }];
 
-#if HAVE(UISCENE)
-        m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
-#else
         m_willEnterForegroundObserver = [notificationCenter addObserverForName:UIApplicationWillEnterForegroundNotification object:application queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UIApplicationWillEnterForeground", this);
-#endif
+            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UIApplicationWillEnterForeground", this);
             applicationWillEnterForeground();
         }];
+#endif
         break;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to