Title: [202331] trunk/Source/WebKit2
Revision
202331
Author
[email protected]
Date
2016-06-22 10:00:23 -0700 (Wed, 22 Jun 2016)

Log Message

Add logging related to process assertions to help debug process suspension issues
https://bugs.webkit.org/show_bug.cgi?id=159001

Reviewed by Antti Koivisto.

Add logging related to process assertions to help debug process suspension issues.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::didChangeIsLoading):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::fetchWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityToken):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setIsHoldingLockedFiles):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (202330 => 202331)


--- trunk/Source/WebKit2/ChangeLog	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-22 17:00:23 UTC (rev 202331)
@@ -1,3 +1,24 @@
+2016-06-22  Chris Dumez  <[email protected]>
+
+        Add logging related to process assertions to help debug process suspension issues
+        https://bugs.webkit.org/show_bug.cgi?id=159001
+
+        Reviewed by Antti Koivisto.
+
+        Add logging related to process assertions to help debug process suspension issues.
+
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::didChangeIsLoading):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::fetchWebsiteData):
+        (WebKit::NetworkProcessProxy::deleteWebsiteData):
+        (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
+        (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::updateActivityToken):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
+
 2016-06-21  Sam Weinig  <[email protected]>
 
         WKWebView with no WKNavigationDelegate does not follow universal links

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (202330 => 202331)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2016-06-22 17:00:23 UTC (rev 202331)
@@ -821,10 +821,13 @@
 void NavigationState::didChangeIsLoading()
 {
 #if PLATFORM(IOS)
-    if (m_webView->_page->pageLoadState().isLoading())
+    if (m_webView->_page->pageLoadState().isLoading()) {
+        LOG_ALWAYS(m_webView->_page->isAlwaysOnLoggingAllowed(), "UIProcess is taking a background assertion because a page load started");
         m_activityToken = m_webView->_page->process().throttler().backgroundActivityToken();
-    else
+    } else {
+        LOG_ALWAYS(m_webView->_page->isAlwaysOnLoggingAllowed(), "UIProcess is releasing a background assertion because a page load completed");
         m_activityToken = nullptr;
+    }
 #endif
 
     [m_webView didChangeValueForKey:@"loading"];

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (202330 => 202331)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-06-22 17:00:23 UTC (rev 202331)
@@ -126,9 +126,11 @@
 
     uint64_t callbackID = generateCallbackID();
     auto token = throttler().backgroundActivityToken();
+    LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is taking a background assertion because the Network process is fetching Website data");
 
-    m_pendingFetchWebsiteDataCallbacks.add(callbackID, [token, completionHandler](WebsiteData websiteData) {
+    m_pendingFetchWebsiteDataCallbacks.add(callbackID, [token, completionHandler, sessionID](WebsiteData websiteData) {
         completionHandler(WTFMove(websiteData));
+        LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is releasing a background assertion because the Network process is done fetching Website data");
     });
 
     send(Messages::NetworkProcess::FetchWebsiteData(sessionID, dataTypes, fetchOptions, callbackID), 0);
@@ -138,9 +140,11 @@
 {
     auto callbackID = generateCallbackID();
     auto token = throttler().backgroundActivityToken();
+    LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is taking a background assertion because the Network process is deleting Website data");
 
-    m_pendingDeleteWebsiteDataCallbacks.add(callbackID, [token, completionHandler] {
+    m_pendingDeleteWebsiteDataCallbacks.add(callbackID, [token, completionHandler, sessionID] {
         completionHandler();
+        LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is releasing a background assertion because the Network process is done deleting Website data");
     });
     send(Messages::NetworkProcess::DeleteWebsiteData(sessionID, dataTypes, modifiedSince, callbackID), 0);
 }
@@ -151,9 +155,11 @@
 
     uint64_t callbackID = generateCallbackID();
     auto token = throttler().backgroundActivityToken();
+    LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is taking a background assertion because the Network process is deleting Website data for several origins");
 
-    m_pendingDeleteWebsiteDataForOriginsCallbacks.add(callbackID, [token, completionHandler] {
+    m_pendingDeleteWebsiteDataForOriginsCallbacks.add(callbackID, [token, completionHandler, sessionID] {
         completionHandler();
+        LOG_ALWAYS(sessionID.isAlwaysOnLoggingAllowed(), "UIProcess is releasing a background assertion because the Network process is done deleting Website data for several origins");
     });
 
     Vector<SecurityOriginData> originData;
@@ -383,11 +389,14 @@
 void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
 {
     if (!isHoldingLockedFiles) {
+        LOG_ALWAYS(true, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files");
         m_tokenForHoldingLockedFiles = nullptr;
         return;
     }
-    if (!m_tokenForHoldingLockedFiles)
+    if (!m_tokenForHoldingLockedFiles) {
+        LOG_ALWAYS(true, "UIProcess is taking a background assertion because the Network process is holding locked files");
         m_tokenForHoldingLockedFiles = m_throttler.backgroundActivityToken();
+    }
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202330 => 202331)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-22 17:00:23 UTC (rev 202331)
@@ -180,6 +180,8 @@
 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
 
+#define WEBPAGEPROXY_LOG_ALWAYS(...) LOG_ALWAYS(isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+
 using namespace WebCore;
 
 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
@@ -1485,6 +1487,11 @@
     m_viewWasEverInWindow |= isNowInWindow;
 }
 
+bool WebPageProxy::isAlwaysOnLoggingAllowed() const
+{
+    return sessionID().isAlwaysOnLoggingAllowed();
+}
+
 void WebPageProxy::updateActivityToken()
 {
     if (m_viewState & ViewState::IsVisuallyIdle)
@@ -1493,10 +1500,16 @@
         m_pageIsUserObservableCount = m_process->processPool().userObservablePageCount();
 
 #if PLATFORM(IOS)
-    if (!isViewVisible() && !m_alwaysRunsAtForegroundPriority)
+    if (!isViewVisible() && !m_alwaysRunsAtForegroundPriority) {
+        WEBPAGEPROXY_LOG_ALWAYS("UIProcess is releasing a foreground assertion because the view is no longer visible");
         m_activityToken = nullptr;
-    else if (!m_activityToken)
+    } else if (!m_activityToken) {
+        if (isViewVisible())
+            WEBPAGEPROXY_LOG_ALWAYS("UIProcess is taking a foreground assertion because the view is visible");
+        else
+            WEBPAGEPROXY_LOG_ALWAYS("UIProcess is taking a foreground assertion even though the view is not visible because m_alwaysRunsAtForegroundPriority is true");
         m_activityToken = m_process->throttler().foregroundActivityToken();
+    }
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (202330 => 202331)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-06-22 17:00:23 UTC (rev 202331)
@@ -1116,6 +1116,8 @@
 
     bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
 
+    bool isAlwaysOnLoggingAllowed() const;
+
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
     void platformInitialize();

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (202330 => 202331)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2016-06-22 16:58:17 UTC (rev 202330)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2016-06-22 17:00:23 UTC (rev 202331)
@@ -987,11 +987,14 @@
 void WebProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
 {
     if (!isHoldingLockedFiles) {
+        LOG_ALWAYS(true, "UIProcess is releasing a background assertion because the WebContent process is no longer holding locked files");
         m_tokenForHoldingLockedFiles = nullptr;
         return;
     }
-    if (!m_tokenForHoldingLockedFiles)
+    if (!m_tokenForHoldingLockedFiles) {
+        LOG_ALWAYS(true, "UIProcess is taking a background assertion because the WebContent process is holding locked files");
         m_tokenForHoldingLockedFiles = m_throttler.backgroundActivityToken();
+    }
 }
 
 void WebProcessProxy::isResponsive(std::function<void(bool isWebProcessResponsive)> callback)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to