Changeset 149199 in webkit


Ignore:
Timestamp:
Apr 26, 2013 11:40:29 AM (11 years ago)
Author:
ap@apple.com
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:
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r149198 r149199  
     12013-04-26  Alexey Proskuryakov  <ap@apple.com>
     2
     3        [WK2] Remove NetworkResourceLoader::cleanupOnMainThread
     4        https://bugs.webkit.org/show_bug.cgi?id=115268
     5
     6        Reviewed by Brady Eidson.
     7
     8        All cleanup() callers are now on main thread, and this indirection only complicates debugging.
     9
     10        * NetworkProcess/NetworkResourceLoader.cpp:
     11        (WebKit::NetworkResourceLoader::connectionToWebProcessDidClose):
     12        (WebKit::NetworkResourceLoader::abortInProgressLoad):
     13        (WebKit::NetworkResourceLoader::didFinishLoading):
     14        (WebKit::NetworkResourceLoader::didFail):
     15        * NetworkProcess/NetworkResourceLoader.h:
     16
    1172013-04-26  Andy Estes  <aestes@apple.com>
    218
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp

    r148922 r149199  
    9191}
    9292
    93 static bool performCleanupsCalled = false;
    94 
    95 static Mutex& requestsToCleanupMutex()
    96 {
    97     DEFINE_STATIC_LOCAL(Mutex, mutex, ());
    98     return mutex;
    99 }
    100 
    101 static HashSet<NetworkResourceLoader*>& requestsToCleanup()
    102 {
    103     DEFINE_STATIC_LOCAL(HashSet<NetworkResourceLoader*>, requests, ());
    104     return requests;
    105 }
    106 
    107 void NetworkResourceLoader::scheduleCleanupOnMainThread()
    108 {
    109     MutexLocker locker(requestsToCleanupMutex());
    110 
    111     requestsToCleanup().add(this);
    112     if (!performCleanupsCalled) {
    113         performCleanupsCalled = true;
    114         callOnMainThread(NetworkResourceLoader::performCleanups, 0);
    115     }
    116 }
    117 
    118 void NetworkResourceLoader::performCleanups(void*)
    119 {
    120     ASSERT(performCleanupsCalled);
    121 
    122     Vector<NetworkResourceLoader*> requests;
    123     {
    124         MutexLocker locker(requestsToCleanupMutex());
    125         copyToVector(requestsToCleanup(), requests);
    126         requestsToCleanup().clear();
    127         performCleanupsCalled = false;
    128     }
    129    
    130     for (size_t i = 0; i < requests.size(); ++i)
    131         requests[i]->cleanup();
    132 }
    133 
    13493void NetworkResourceLoader::cleanup()
    13594{
     
    159118        return;
    160119
    161 #if !ASSERT_DISABLED
    162     // Since there's no handle, this loader should never have been started, and therefore it should never be in the
    163     // set of loaders to cleanup on the main thread.
    164     // Let's make sure that's true.
    165     {
    166         MutexLocker locker(requestsToCleanupMutex());
    167         ASSERT(!requestsToCleanup().contains(this));
    168     }
    169 #endif
    170 
    171120    cleanup();
    172121}
     
    195144    m_handle->cancel();
    196145
    197     scheduleCleanupOnMainThread();
     146    cleanup();
    198147}
    199148
     
    249198    send(Messages::WebResourceLoader::DidFinishResourceLoad(finishTime));
    250199   
    251     scheduleCleanupOnMainThread();
     200    cleanup();
    252201}
    253202
     
    258207    invalidateSandboxExtensions();
    259208    send(Messages::WebResourceLoader::DidFailResourceLoad(error));
    260     scheduleCleanupOnMainThread();
     209    cleanup();
    261210}
    262211
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h

    r148922 r149199  
    112112#endif
    113113
    114     void scheduleCleanupOnMainThread();
    115     static void performCleanups(void*);
    116114    void cleanup();
    117115   
Note: See TracChangeset for help on using the changeset viewer.