Changeset 132695 in webkit


Ignore:
Timestamp:
Oct 26, 2012, 2:30:22 PM (13 years ago)
Author:
beidson@apple.com
Message:

Crash in WebProces at WebCore::ResourceLoadScheduler::crossOriginRedirectReceived + 78
<rdar://problem/12575514> and https://bugs.webkit.org/show_bug.cgi?id=100554

Reviewed by Alexey Proskuryakov.

This was fallout from http://trac.webkit.org/changeset/132501 where I missed some of the
spots that call resourceLoadScheduler().

As a result we were creating more than one ResourceLoadScheduler, allowing the host records
to get out of sync.

The fix that also results in less #ifdefs scattered throughout the code is to use a single
choke point for all ResourceLoadScheduler access.

No new tests
(No change of behavior for the default config, not testable at this time in the repro config)

Add a single choke point for accessing the correct ResourceLoadScheduler:

  • loader/ResourceLoadScheduler.cpp:

(WebCore::defaultResourceLoadScheduler): New private function that keeps the singleton default ResourceLoadScheduler.
(WebCore::resourceLoadScheduler): Refactor this function to either ask the LoaderStrategy or call through to

Revert back to using that single choke point everywhere:

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::suspendPostAttachCallbacks):
(WebCore::ContainerNode::resumePostAttachCallbacks):

  • loader/MainResourceLoader.cpp:

(WebCore::MainResourceLoader::loadNow):

  • loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::releaseResources):
(WebCore::ResourceLoader::willSendRequest):

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::load):

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::performPostLoadActions):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r132692 r132695  
     12012-10-26  Brady Eidson  <beidson@apple.com>
     2
     3        Crash in WebProces at WebCore::ResourceLoadScheduler::crossOriginRedirectReceived + 78
     4        <rdar://problem/12575514> and https://bugs.webkit.org/show_bug.cgi?id=100554
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        This was fallout from http://trac.webkit.org/changeset/132501 where I missed some of the
     9        spots that call resourceLoadScheduler().
     10
     11        As a result we were creating more than one ResourceLoadScheduler, allowing the host records
     12        to get out of sync.
     13
     14        The fix that also results in less #ifdefs scattered throughout the code is to use a single
     15        choke point for all ResourceLoadScheduler access.
     16
     17        No new tests
     18        (No change of behavior for the default config, not testable at this time in the repro config)
     19
     20        Add a single choke point for accessing the correct ResourceLoadScheduler:
     21        * loader/ResourceLoadScheduler.cpp:
     22        (WebCore::defaultResourceLoadScheduler): New private function that keeps the singleton default ResourceLoadScheduler.
     23        (WebCore::resourceLoadScheduler): Refactor this function to either ask the LoaderStrategy or call through to
     24
     25        Revert back to using that single choke point everywhere:
     26        * dom/ContainerNode.cpp:
     27        (WebCore::ContainerNode::suspendPostAttachCallbacks):
     28        (WebCore::ContainerNode::resumePostAttachCallbacks):
     29
     30        * loader/MainResourceLoader.cpp:
     31        (WebCore::MainResourceLoader::loadNow):
     32
     33        * loader/ResourceLoader.cpp:
     34        (WebCore::ResourceLoader::releaseResources):
     35        (WebCore::ResourceLoader::willSendRequest):
     36
     37        * loader/cache/CachedResource.cpp:
     38        (WebCore::CachedResource::load):
     39
     40        * loader/cache/CachedResourceLoader.cpp:
     41        (WebCore::CachedResourceLoader::performPostLoadActions):
     42
    1432012-10-26  Elliott Sprehn  <esprehn@chromium.org>
    244
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r132501 r132695  
    3636#include "InsertionPoint.h"
    3737#include "InspectorInstrumentation.h"
    38 #include "LoaderStrategy.h"
    3938#include "MemoryCache.h"
    4039#include "MutationEvent.h"
    41 #include "ResourceLoadScheduler.h"
    4240#include "Page.h"
    43 #include "PlatformStrategies.h"
    4441#include "RenderBox.h"
    4542#include "RenderTheme.h"
    4643#include "RenderWidget.h"
     44#include "ResourceLoadScheduler.h"
    4745#include "RootInlineBox.h"
    4846#include "UndoManager.h"
     
    644642            }
    645643        }
    646 #if USE(PLATFORM_STRATEGIES)
    647         platformStrategies()->loaderStrategy()->resourceLoadScheduler()->suspendPendingRequests();
    648 #else
    649644        resourceLoadScheduler()->suspendPendingRequests();
    650 #endif
    651645    }
    652646    ++s_attachDepth;
     
    665659                page->setMemoryCacheClientCallsEnabled(true);
    666660        }
    667 #if USE(PLATFORM_STRATEGIES)
    668         platformStrategies()->loaderStrategy()->resourceLoadScheduler()->resumePendingRequests();
    669 #else
    670661        resourceLoadScheduler()->resumePendingRequests();
    671 #endif
    672662    }
    673663    --s_attachDepth;
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r132501 r132695  
    4545#include "HistoryItem.h"
    4646#include "InspectorInstrumentation.h"
    47 #include "LoaderStrategy.h"
    4847#include "Page.h"
    49 #include "PlatformStrategies.h"
    5048#include "ResourceError.h"
    5149#include "ResourceHandle.h"
     
    633631        return true;
    634632
    635 #if USE(PLATFORM_STRATEGIES)
    636     platformStrategies()->loaderStrategy()->resourceLoadScheduler()->addMainResourceLoad(this);
    637 #else
    638633    resourceLoadScheduler()->addMainResourceLoad(this);
    639 #endif
    640634
    641635    if (m_substituteData.isValid())
  • trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp

    r132501 r132695  
    3232#include "InspectorInstrumentation.h"
    3333#include "KURL.h"
     34#include "LoaderStrategy.h"
    3435#include "Logging.h"
    3536#include "NetscapePlugInStreamLoader.h"
     37#include "PlatformStrategies.h"
    3638#include "ResourceLoader.h"
    3739#include "ResourceRequest.h"
     
    7274}
    7375
    74 ResourceLoadScheduler* resourceLoadScheduler()
     76ResourceLoadScheduler* ResourceLoadScheduler::defaultResourceLoadScheduler()
    7577{
    7678    ASSERT(isMainThread());
    7779    DEFINE_STATIC_LOCAL(ResourceLoadScheduler, resourceLoadScheduler, ());
    7880    return &resourceLoadScheduler;
     81}
     82
     83ResourceLoadScheduler* resourceLoadScheduler()
     84{
     85#if USE(PLATFORM_STRATEGIES)
     86    return platformStrategies()->loaderStrategy()->resourceLoadScheduler();
     87#else
     88    return ResourceLoadScheduler::defaultResourceLoadScheduler();
     89#endif
    7990}
    8091
  • trunk/Source/WebCore/loader/ResourceLoadScheduler.h

    r132501 r132695  
    106106    void servePendingRequests(HostInformation*, ResourceLoadPriority);
    107107
     108    static ResourceLoadScheduler* defaultResourceLoadScheduler();
     109
    108110    typedef HashMap<String, HostInformation*, StringHash> HostMap;
    109111    HostMap m_hosts;
  • trunk/Source/WebCore/loader/ResourceLoader.cpp

    r132501 r132695  
    3838#include "FrameLoaderClient.h"
    3939#include "InspectorInstrumentation.h"
    40 #include "LoaderStrategy.h"
    4140#include "Page.h"
    42 #include "PlatformStrategies.h"
    4341#include "ProgressTracker.h"
    4442#include "ResourceBuffer.h"
     
    9290    m_reachedTerminalState = true;
    9391
    94 #if USE(PLATFORM_STRATEGIES)
    95     platformStrategies()->loaderStrategy()->resourceLoadScheduler()->remove(this);
    96 #endif
     92    resourceLoadScheduler()->remove(this);
     93
    9794    m_identifier = 0;
    98 #if !USE(PLATFORM_STRATEGIES)
    99     resourceLoadScheduler()->remove(this);
    100 #endif
    10195
    10296    if (m_handle) {
     
    244238    }
    245239
    246     if (!redirectResponse.isNull()) {
    247 #if USE(PLATFORM_STRATEGIES)
    248         platformStrategies()->loaderStrategy()->resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
    249 #else
     240    if (!redirectResponse.isNull())
    250241        resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
    251 #endif
    252     }
     242
    253243    m_request = request;
    254244}
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r132520 r132695  
    3737#include "InspectorInstrumentation.h"
    3838#include "KURL.h"
    39 #include "LoaderStrategy.h"
    4039#include "Logging.h"
    41 #include "PlatformStrategies.h"
    4240#include "PurgeableBuffer.h"
    4341#include "ResourceBuffer.h"
     
    286284        addAdditionalRequestHeaders(cachedResourceLoader);
    287285
    288 #if USE(PLATFORM_STRATEGIES)
    289     m_loader = platformStrategies()->loaderStrategy()->resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
    290 #else
    291286    m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
    292 #endif
    293287
    294288    if (!m_loader) {
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r132520 r132695  
    4545#include "FrameLoaderClient.h"
    4646#include "HTMLElement.h"
    47 #include "LoaderStrategy.h"
    4847#include "Logging.h"
    4948#include "MemoryCache.h"
    5049#include "PingLoader.h"
    51 #include "PlatformStrategies.h"
    5250#include "ResourceLoadScheduler.h"
    5351#include "SecurityOrigin.h"
     
    731729    checkForPendingPreloads();
    732730
    733 #if USE(PLATFORM_STRATEGIES)
    734     platformStrategies()->loaderStrategy()->resourceLoadScheduler()->servePendingRequests();
    735 #else
    736731    resourceLoadScheduler()->servePendingRequests();
    737 #endif
    738732}
    739733
Note: See TracChangeset for help on using the changeset viewer.