Add more threading release assertions
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jul 2018 18:47:18 +0000 (18:47 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jul 2018 18:47:18 +0000 (18:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187647

Reviewed by Alex Christensen.

Add more threading release assertions to help debug <rdar://problem/39265927>.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
(WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::m_isInPrewarmedPool):
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::didFinishLaunching):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/Platform/IPC/Connection.cpp
Source/WebKit/UIProcess/WebProcessProxy.cpp

index 6d6b5ee..49ae7b4 100644 (file)
@@ -1,3 +1,21 @@
+2018-07-13  Chris Dumez  <cdumez@apple.com>
+
+        Add more threading release assertions
+        https://bugs.webkit.org/show_bug.cgi?id=187647
+
+        Reviewed by Alex Christensen.
+
+        Add more threading release assertions to help debug <rdar://problem/39265927>.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
+        (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::m_isInPrewarmedPool):
+        (WebKit::WebProcessProxy::~WebProcessProxy):
+        (WebKit::WebProcessProxy::shutDown):
+        (WebKit::WebProcessProxy::didFinishLaunching):
+
 2018-07-13  Christopher Reid  <chris.reid@sony.com>
 
         [WinCairo] Add windows storage process connection implementation
index 26b1d02..a31f171 100644 (file)
@@ -74,11 +74,14 @@ NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(IPC::Connection::Id
     , m_mdnsRegister(*this)
 #endif
 {
+    RELEASE_ASSERT(RunLoop::isMain());
     m_connection->open();
 }
 
 NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess()
 {
+    RELEASE_ASSERT(RunLoop::isMain());
+
     m_connection->invalidate();
 #if USE(LIBWEBRTC)
     if (m_rtcProvider)
index e24f1e3..2a152b8 100644 (file)
@@ -936,7 +936,7 @@ void Connection::enqueueIncomingMessage(std::unique_ptr<Decoder> incomingMessage
 
 void Connection::dispatchMessage(Decoder& decoder)
 {
-    ASSERT(isValid());
+    RELEASE_ASSERT(isValid());
     m_client.didReceiveMessage(*this, decoder);
 }
 
index 5e4ea37..5c68ba6 100644 (file)
@@ -128,6 +128,8 @@ WebProcessProxy::WebProcessProxy(WebProcessPool& processPool, WebsiteDataStore&
 #endif
     , m_isInPrewarmedPool(isInPrewarmedPool == IsInPrewarmedPool::Yes)
 {
+    RELEASE_ASSERT(RunLoop::isMain());
+
     auto result = allProcesses().add(coreProcessIdentifier(), this);
     ASSERT_UNUSED(result, result.isNewEntry);
 
@@ -136,6 +138,7 @@ WebProcessProxy::WebProcessProxy(WebProcessPool& processPool, WebsiteDataStore&
 
 WebProcessProxy::~WebProcessProxy()
 {
+    RELEASE_ASSERT(RunLoop::isMain());
     ASSERT(m_pageURLRetainCountMap.isEmpty());
 
     auto result = allProcesses().remove(coreProcessIdentifier());
@@ -207,6 +210,8 @@ void WebProcessProxy::processWillShutDown(IPC::Connection& connection)
 
 void WebProcessProxy::shutDown()
 {
+    RELEASE_ASSERT(RunLoop::isMain());
+
     shutDownProcess();
 
     if (m_webConnection) {
@@ -751,6 +756,8 @@ bool WebProcessProxy::mayBecomeUnresponsive()
 
 void WebProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
 {
+    RELEASE_ASSERT(RunLoop::isMain());
+
     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
 
     if (!IPC::Connection::identifierIsValid(connectionIdentifier)) {
@@ -764,6 +771,7 @@ void WebProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connect
         page->processDidFinishLaunching();
     }
 
+    RELEASE_ASSERT(!m_webConnection);
     m_webConnection = WebConnectionToWebProcess::create(this);
 
     m_processPool->processDidFinishLaunching(this);