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

Log Message

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

    Add better logging for when the view visibility state changes
    https://bugs.webkit.org/show_bug.cgi?id=202008

    Reviewed by Geoffrey Garen.

    * UIProcess/ApplicationStateTracker.mm:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::updateActivityState):
    * UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::applicationDidEnterBackground):
    (WebKit::WebPageProxy::applicationWillEnterForeground):

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

Modified Paths

Diff

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


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 22:54:16 UTC (rev 250365)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 23:08:20 UTC (rev 250366)
@@ -1,5 +1,37 @@
 2019-09-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r250111. rdar://problem/55644650
+
+    Add better logging for when the view visibility state changes
+    https://bugs.webkit.org/show_bug.cgi?id=202008
+    
+    Reviewed by Geoffrey Garen.
+    
+    * UIProcess/ApplicationStateTracker.mm:
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::updateActivityState):
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::applicationDidEnterBackground):
+    (WebKit::WebPageProxy::applicationWillEnterForeground):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-19  Chris Dumez  <[email protected]>
+
+            Add better logging for when the view visibility state changes
+            https://bugs.webkit.org/show_bug.cgi?id=202008
+
+            Reviewed by Geoffrey Garen.
+
+            * UIProcess/ApplicationStateTracker.mm:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::updateActivityState):
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::applicationDidEnterBackground):
+            (WebKit::WebPageProxy::applicationWillEnterForeground):
+
+2019-09-25  Alan Coon  <[email protected]>
+
         Cherry-pick r249933. rdar://problem/55461414
 
     REGRESSION: iPad: Safari becomes unresponsive after context menu on 1-800-MY-APPLE phone number, tapping 'Add to Contacts'

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


--- branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 22:54:16 UTC (rev 250365)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 23:08:20 UTC (rev 250366)
@@ -105,11 +105,14 @@
     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_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
+            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
 #else
         m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification object:application queue:nil usingBlock:[this](NSNotification *) {
+            RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UIApplicationDidEnterBackground", this);
 #endif
             applicationDidEnterBackground();
         }];
@@ -116,8 +119,10 @@
 
 #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
             applicationWillEnterForeground();
         }];

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (250365 => 250366)


--- branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-25 22:54:16 UTC (rev 250365)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-25 23:08:20 UTC (rev 250366)
@@ -1708,13 +1708,19 @@
 
 void WebPageProxy::updateActivityState(OptionSet<ActivityState::Flag> flagsToUpdate)
 {
+    bool wasVisible = isViewVisible();
     m_activityState.remove(flagsToUpdate);
     if (flagsToUpdate & ActivityState::IsFocused && pageClient().isViewFocused())
         m_activityState.add(ActivityState::IsFocused);
     if (flagsToUpdate & ActivityState::WindowIsActive && pageClient().isViewWindowActive())
         m_activityState.add(ActivityState::WindowIsActive);
-    if (flagsToUpdate & ActivityState::IsVisible && pageClient().isViewVisible())
-        m_activityState.add(ActivityState::IsVisible);
+    if (flagsToUpdate & ActivityState::IsVisible) {
+        bool isNowVisible = pageClient().isViewVisible();
+        if (isNowVisible)
+            m_activityState.add(ActivityState::IsVisible);
+        if (wasVisible != isNowVisible)
+            RELEASE_LOG_IF_ALLOWED(ViewState, "updateActivityState: view visibility state changed %d -> %d", wasVisible, isNowVisible);
+    }
     if (flagsToUpdate & ActivityState::IsVisibleOrOccluded && pageClient().isViewVisibleOrOccluded())
         m_activityState.add(ActivityState::IsVisibleOrOccluded);
     if (flagsToUpdate & ActivityState::IsInWindow && pageClient().isViewInWindow())

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (250365 => 250366)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-09-25 22:54:16 UTC (rev 250365)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-09-25 23:08:20 UTC (rev 250366)
@@ -74,6 +74,8 @@
 #import <wtf/text/WTFString.h>
 #endif
 
+#define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), channel, "%p - [pageProxyID=%llu, webPageID=%llu, PID=%i] WebPageProxy::" fmt, this, m_identifier.toUInt64(), m_webPageID.toUInt64(), m_process->processIdentifier(), ##__VA_ARGS__)
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -647,6 +649,8 @@
 void WebPageProxy::applicationDidEnterBackground()
 {
     bool isSuspendedUnderLock = [UIApp isSuspendedUnderLock];
+    
+    RELEASE_LOG_IF_ALLOWED(ViewState, "applicationDidEnterBackground: isSuspendedUnderLock? %d", isSuspendedUnderLock);
 
 #if !PLATFORM(WATCHOS)
     // We normally delay process suspension when the app is backgrounded until the current page load completes. However,
@@ -1478,4 +1482,6 @@
 
 } // namespace WebKit
 
+#undef RELEASE_LOG_IF_ALLOWED
+
 #endif // PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to