Title: [187303] branches/safari-601.1-branch/Source

Diff

Modified: branches/safari-601.1-branch/Source/WTF/ChangeLog (187302 => 187303)


--- branches/safari-601.1-branch/Source/WTF/ChangeLog	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WTF/ChangeLog	2015-07-24 06:56:46 UTC (rev 187303)
@@ -1,3 +1,22 @@
+2015-07-23  Lucas Forschler  <[email protected]>
+
+        Merge r187129
+
+    2015-07-21  Daniel Bates  <[email protected]>
+
+            WTFCrash() in WebKit::WebProcess::networkConnection()
+            https://bugs.webkit.org/show_bug.cgi?id=147112
+            <rdar://problem/18477459>
+
+            Reviewed by Gavin Barraclough.
+
+            Add explicit boolean conversion function and remove overload of operator! to support
+            checking whether an activity token is valid more directly than using the overloaded operator!.
+
+            * wtf/RefCounter.h:
+            (WTF::RefCounter::Token::operator bool): Added.
+            (WTF::RefCounter::Token::operator!): Deleted.
+
 2015-07-20  Matthew Hanson  <[email protected]>
 
         Merge r186910. rdar://problem/21863296

Modified: branches/safari-601.1-branch/Source/WTF/wtf/RefCounter.h (187302 => 187303)


--- branches/safari-601.1-branch/Source/WTF/wtf/RefCounter.h	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WTF/wtf/RefCounter.h	2015-07-24 06:56:46 UTC (rev 187303)
@@ -67,7 +67,7 @@
         inline Token<T>& operator=(const Token<T>&);
         inline Token<T>& operator=(Token<T>&&);
 
-        bool operator!() const { return !m_ptr; }
+        explicit operator bool() const { return m_ptr; }
 
     private:
         friend class RefCounter;

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187302 => 187303)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 06:56:46 UTC (rev 187303)
@@ -1,5 +1,44 @@
 2015-07-23  Lucas Forschler  <[email protected]>
 
+        Merge r187129
+
+    2015-07-21  Daniel Bates  <[email protected]>
+
+            WTFCrash() in WebKit::WebProcess::networkConnection()
+            https://bugs.webkit.org/show_bug.cgi?id=147112
+            <rdar://problem/18477459>
+
+            Reviewed by Gavin Barraclough.
+
+            Fixes an issue where a newly launched network process may be jetsam'd because it has not
+            taken a process assertion between the time it was launched and the time when a web process
+            makes use of it.
+
+            Initially a network process does not have a process assertion. A process assertion is taken
+            (if one has not been taken) for the network process when a process assertion is taken for at
+            least one web process. When the network process crashes a WebProcess may ultimately launch a
+            new network process in WebProcess::networkConnection(). The new network process may be jetsam'd
+            immediately when the system is under some measure pressure because it has a low jetsam priority,
+            0 (since it does not have a process assertion and higher priority implies that a process is less
+            likely to be jetsam'd). And the logic in WebProcess::networkConnection() explicitly calls
+            CRASH() if the newly launched network process crashes immediately. Towards preventing the newly
+            launched network process from being jetsam'd we should obtain a process assertion for it.
+
+            * UIProcess/WebProcessPool.cpp:
+            (WebKit::WebProcessPool::WebProcessPool): Initialize m_didNetworkProcessCrash to false.
+            (WebKit::WebProcessPool::ensureNetworkProcess): If the network process crashed (m_didNetworkProcessCrash == true)
+            then tell each process in the pool to reinstate their network activity token for the new network process.
+            (WebKit::WebProcessPool::networkProcessCrashed): Set m_didNetworkProcessCrash to true when the
+            network process crashed.
+            * UIProcess/WebProcessPool.h:
+            * UIProcess/WebProcessProxy.cpp:
+            (WebKit::WebProcessProxy::reinstateNetworkProcessAssertionState): Added.
+            (WebKit::WebProcessProxy::didSetAssertionState): Add assert to ensure we never have both
+            a background- and foreground- activity token for the network process.
+            * UIProcess/WebProcessProxy.h:
+
+2015-07-23  Lucas Forschler  <[email protected]>
+
         Merge r187117
 
     2015-07-21  Tim Horton  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp (187302 => 187303)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-07-24 06:56:46 UTC (rev 187303)
@@ -160,6 +160,7 @@
     , m_processTerminationEnabled(true)
 #if ENABLE(NETWORK_PROCESS)
     , m_canHandleHTTPSServerTrustEvaluation(true)
+    , m_didNetworkProcessCrash(false)
 #endif
 #if USE(SOUP)
     , m_ignoreTLSErrors(true)
@@ -419,6 +420,12 @@
     m_networkProcess->send(Messages::NetworkProcess::SetQOS(networkProcessLatencyQOS(), networkProcessThroughputQOS()), 0);
 #endif
 
+    if (m_didNetworkProcessCrash) {
+        m_didNetworkProcessCrash = false;
+        for (auto& process : m_processes)
+            process->reinstateNetworkProcessAssertionState(*m_networkProcess);
+    }
+
     return *m_networkProcess;
 }
 
@@ -426,6 +433,7 @@
 {
     ASSERT(m_networkProcess);
     ASSERT(networkProcessProxy == m_networkProcess.get());
+    m_didNetworkProcessCrash = true;
 
     WebContextSupplementMap::const_iterator it = m_supplements.begin();
     WebContextSupplementMap::const_iterator end = m_supplements.end();

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.h (187302 => 187303)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.h	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessPool.h	2015-07-24 06:56:46 UTC (rev 187303)
@@ -498,6 +498,7 @@
 
 #if ENABLE(NETWORK_PROCESS)
     bool m_canHandleHTTPSServerTrustEvaluation;
+    bool m_didNetworkProcessCrash;
     RefPtr<NetworkProcessProxy> m_networkProcess;
 #endif
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp (187302 => 187303)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2015-07-24 06:56:46 UTC (rev 187303)
@@ -925,9 +925,24 @@
     m_throttler.didCancelProcessSuspension();
 }
 
+#if ENABLE(NETWORK_PROCESS)
+void WebProcessProxy::reinstateNetworkProcessAssertionState(NetworkProcessProxy& newNetworkProcessProxy)
+{
+    ASSERT(!m_backgroundTokenForNetworkProcess || !m_foregroundTokenForNetworkProcess);
+
+    // The network process crashed; take new tokens for the new network process.
+    if (m_backgroundTokenForNetworkProcess)
+        m_backgroundTokenForNetworkProcess = newNetworkProcessProxy.throttler().backgroundActivityToken();
+    else if (m_foregroundTokenForNetworkProcess)
+        m_foregroundTokenForNetworkProcess = newNetworkProcessProxy.throttler().foregroundActivityToken();
+}
+#endif
+
 void WebProcessProxy::didSetAssertionState(AssertionState state)
 {
 #if PLATFORM(IOS) && ENABLE(NETWORK_PROCESS)
+    ASSERT(!m_backgroundTokenForNetworkProcess || !m_foregroundTokenForNetworkProcess);
+
     switch (state) {
     case AssertionState::Suspended:
         m_foregroundTokenForNetworkProcess = nullptr;
@@ -950,6 +965,8 @@
             page->processWillBecomeForeground();
         break;
     }
+
+    ASSERT(!m_backgroundTokenForNetworkProcess || !m_foregroundTokenForNetworkProcess);
 #else
     UNUSED_PARAM(state);
 #endif

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.h (187302 => 187303)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.h	2015-07-24 06:34:44 UTC (rev 187302)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebProcessProxy.h	2015-07-24 06:56:46 UTC (rev 187303)
@@ -59,6 +59,7 @@
 namespace WebKit {
 
 class DownloadProxyMap;
+class NetworkProcessProxy;
 class WebBackForwardListItem;
 class WebPageGroup;
 class WebProcessPool;
@@ -150,6 +151,10 @@
 
     ProcessThrottler& throttler() { return m_throttler; }
 
+#if ENABLE(NETWORK_PROCESS)
+    void reinstateNetworkProcessAssertionState(NetworkProcessProxy&);
+#endif
+
 private:
     explicit WebProcessProxy(WebProcessPool&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to