Title: [149199] trunk/Source/WebKit2
Revision
149199
Author
[email protected]
Date
2013-04-26 11:40:29 -0700 (Fri, 26 Apr 2013)

Log Message

        [WK2] Remove NetworkResourceLoader::cleanupOnMainThread
        https://bugs.webkit.org/show_bug.cgi?id=115268

        Reviewed by Brady Eidson.

        All cleanup() callers are now on main thread, and this indirection only complicates debugging.

        * NetworkProcess/NetworkResourceLoader.cpp:
        (WebKit::NetworkResourceLoader::connectionToWebProcessDidClose):
        (WebKit::NetworkResourceLoader::abortInProgressLoad):
        (WebKit::NetworkResourceLoader::didFinishLoading):
        (WebKit::NetworkResourceLoader::didFail):
        * NetworkProcess/NetworkResourceLoader.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (149198 => 149199)


--- trunk/Source/WebKit2/ChangeLog	2013-04-26 18:24:08 UTC (rev 149198)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-26 18:40:29 UTC (rev 149199)
@@ -1,3 +1,19 @@
+2013-04-26  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] Remove NetworkResourceLoader::cleanupOnMainThread
+        https://bugs.webkit.org/show_bug.cgi?id=115268
+
+        Reviewed by Brady Eidson.
+
+        All cleanup() callers are now on main thread, and this indirection only complicates debugging.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::connectionToWebProcessDidClose):
+        (WebKit::NetworkResourceLoader::abortInProgressLoad):
+        (WebKit::NetworkResourceLoader::didFinishLoading):
+        (WebKit::NetworkResourceLoader::didFail):
+        * NetworkProcess/NetworkResourceLoader.h:
+
 2013-04-26  Andy Estes  <[email protected]>
 
         [WebKit2] CustomProtocolManager's m_registeredSchemes HashSet can be accessed by multiple threads

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (149198 => 149199)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-04-26 18:24:08 UTC (rev 149198)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-04-26 18:40:29 UTC (rev 149199)
@@ -90,47 +90,6 @@
     m_handle = ResourceHandle::create(m_networkingContext.get(), request(), this, false /* defersLoading */, contentSniffingPolicy() == SniffContent);
 }
 
-static bool performCleanupsCalled = false;
-
-static Mutex& requestsToCleanupMutex()
-{
-    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
-    return mutex;
-}
-
-static HashSet<NetworkResourceLoader*>& requestsToCleanup()
-{
-    DEFINE_STATIC_LOCAL(HashSet<NetworkResourceLoader*>, requests, ());
-    return requests;
-}
-
-void NetworkResourceLoader::scheduleCleanupOnMainThread()
-{
-    MutexLocker locker(requestsToCleanupMutex());
-
-    requestsToCleanup().add(this);
-    if (!performCleanupsCalled) {
-        performCleanupsCalled = true;
-        callOnMainThread(NetworkResourceLoader::performCleanups, 0);
-    }
-}
-
-void NetworkResourceLoader::performCleanups(void*)
-{
-    ASSERT(performCleanupsCalled);
-
-    Vector<NetworkResourceLoader*> requests;
-    {
-        MutexLocker locker(requestsToCleanupMutex());
-        copyToVector(requestsToCleanup(), requests);
-        requestsToCleanup().clear();
-        performCleanupsCalled = false;
-    }
-    
-    for (size_t i = 0; i < requests.size(); ++i)
-        requests[i]->cleanup();
-}
-
 void NetworkResourceLoader::cleanup()
 {
     ASSERT(isMainThread());
@@ -158,16 +117,6 @@
     if (m_handle)
         return;
 
-#if !ASSERT_DISABLED
-    // Since there's no handle, this loader should never have been started, and therefore it should never be in the
-    // set of loaders to cleanup on the main thread.
-    // Let's make sure that's true.
-    {
-        MutexLocker locker(requestsToCleanupMutex());
-        ASSERT(!requestsToCleanup().contains(this));
-    }
-#endif
-
     cleanup();
 }
 
@@ -194,7 +143,7 @@
 
     m_handle->cancel();
 
-    scheduleCleanupOnMainThread();
+    cleanup();
 }
 
 void NetworkResourceLoader::didReceiveResponseAsync(ResourceHandle*, const ResourceResponse& response)
@@ -248,7 +197,7 @@
     invalidateSandboxExtensions();
     send(Messages::WebResourceLoader::DidFinishResourceLoad(finishTime));
     
-    scheduleCleanupOnMainThread();
+    cleanup();
 }
 
 void NetworkResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
@@ -257,7 +206,7 @@
     // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread.
     invalidateSandboxExtensions();
     send(Messages::WebResourceLoader::DidFailResourceLoad(error));
-    scheduleCleanupOnMainThread();
+    cleanup();
 }
 
 void NetworkResourceLoader::willSendRequestAsync(ResourceHandle*, const ResourceRequest& request, const ResourceResponse& redirectResponse)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (149198 => 149199)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2013-04-26 18:24:08 UTC (rev 149198)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2013-04-26 18:40:29 UTC (rev 149199)
@@ -111,8 +111,6 @@
     void continueCanAuthenticateAgainstProtectionSpace(bool);
 #endif
 
-    void scheduleCleanupOnMainThread();
-    static void performCleanups(void*);
     void cleanup();
     
     void platformDidReceiveResponse(const WebCore::ResourceResponse&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to