Title: [203079] trunk/Source
Revision
203079
Author
ryanhad...@apple.com
Date
2016-07-11 13:11:03 -0700 (Mon, 11 Jul 2016)

Log Message

Unreviewed, rolling out r203064.
https://bugs.webkit.org/show_bug.cgi?id=159642

This change causes LayoutTest crashes on WK1 ASan (Requested
by ryanhaddad on #webkit).

Reverted changeset:

"Use refs for ResourceLoaders"
https://bugs.webkit.org/show_bug.cgi?id=159592
http://trac.webkit.org/changeset/203064

Patch by Commit Queue <commit-qu...@webkit.org> on 2016-07-11

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203078 => 203079)


--- trunk/Source/WebCore/ChangeLog	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebCore/ChangeLog	2016-07-11 20:11:03 UTC (rev 203079)
@@ -1,3 +1,17 @@
+2016-07-11  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r203064.
+        https://bugs.webkit.org/show_bug.cgi?id=159642
+
+        This change causes LayoutTest crashes on WK1 ASan (Requested
+        by ryanhaddad on #webkit).
+
+        Reverted changeset:
+
+        "Use refs for ResourceLoaders"
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
 2016-07-11  Brent Fulgham  <bfulg...@apple.com>
 
         [WebGL] Check for existing buffer exists for enabled vertex array attributes before permitting glDrawArrays to execute

Modified: trunk/Source/WebCore/loader/LoaderStrategy.h (203078 => 203079)


--- trunk/Source/WebCore/loader/LoaderStrategy.h	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebCore/loader/LoaderStrategy.h	2016-07-11 20:11:03 UTC (rev 203079)
@@ -51,9 +51,9 @@
     virtual RefPtr<SubresourceLoader> loadResource(Frame&, CachedResource&, const ResourceRequest&, const ResourceLoaderOptions&) = 0;
     virtual void loadResourceSynchronously(NetworkingContext*, unsigned long identifier, const ResourceRequest&, StoredCredentials, ClientCredentialPolicy, ResourceError&, ResourceResponse&, Vector<char>& data) = 0;
 
-    virtual void remove(ResourceLoader&) = 0;
-    virtual void setDefersLoading(ResourceLoader&, bool) = 0;
-    virtual void crossOriginRedirectReceived(ResourceLoader&, const URL& redirectURL) = 0;
+    virtual void remove(ResourceLoader*) = 0;
+    virtual void setDefersLoading(ResourceLoader*, bool) = 0;
+    virtual void crossOriginRedirectReceived(ResourceLoader*, const URL& redirectURL) = 0;
 
     virtual void servePendingRequests(ResourceLoadPriority minimumPriority = ResourceLoadPriority::VeryLow) = 0;
     virtual void suspendPendingRequests() = 0;

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (203078 => 203079)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2016-07-11 20:11:03 UTC (rev 203079)
@@ -73,7 +73,7 @@
 
 void ResourceLoader::finishNetworkLoad()
 {
-    platformStrategies()->loaderStrategy()->remove(*this);
+    platformStrategies()->loaderStrategy()->remove(this);
 
     if (m_handle) {
         ASSERT(m_handle->client() == this);
@@ -223,7 +223,7 @@
         start();
     }
 
-    platformStrategies()->loaderStrategy()->setDefersLoading(*this, defers);
+    platformStrategies()->loaderStrategy()->setDefersLoading(this, defers);
 }
 
 FrameLoader* ResourceLoader::frameLoader() const
@@ -279,7 +279,7 @@
 void ResourceLoader::willSwitchToSubstituteResource()
 {
     ASSERT(!m_documentLoader->isSubstituteLoadPending(this));
-    platformStrategies()->loaderStrategy()->remove(*this);
+    platformStrategies()->loaderStrategy()->remove(this);
     if (m_handle)
         m_handle->cancel();
 }
@@ -367,7 +367,7 @@
 
     bool isRedirect = !redirectResponse.isNull();
     if (isRedirect)
-        platformStrategies()->loaderStrategy()->crossOriginRedirectReceived(*this, request.url());
+        platformStrategies()->loaderStrategy()->crossOriginRedirectReceived(this, request.url());
 
     m_request = request;
 

Modified: trunk/Source/WebKit/ChangeLog (203078 => 203079)


--- trunk/Source/WebKit/ChangeLog	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit/ChangeLog	2016-07-11 20:11:03 UTC (rev 203079)
@@ -1,3 +1,17 @@
+2016-07-11  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r203064.
+        https://bugs.webkit.org/show_bug.cgi?id=159642
+
+        This change causes LayoutTest crashes on WK1 ASan (Requested
+        by ryanhaddad on #webkit).
+
+        Reverted changeset:
+
+        "Use refs for ResourceLoaders"
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
 2016-07-08  Alex Christensen  <achristen...@webkit.org>
 
         Use refs for ResourceLoaders

Modified: trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.cpp (203078 => 203079)


--- trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.cpp	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.cpp	2016-07-11 20:11:03 UTC (rev 203079)
@@ -67,21 +67,20 @@
 WebResourceLoadScheduler::HostInformation* WebResourceLoadScheduler::hostForURL(const URL& url, CreateHostPolicy createHostPolicy)
 {
     if (!url.protocolIsInHTTPFamily())
-        return &m_nonHTTPProtocolHost;
+        return m_nonHTTPProtocolHost;
 
     m_hosts.checkConsistency();
     String hostName = url.host();
     HostInformation* host = m_hosts.get(hostName);
     if (!host && createHostPolicy == CreateIfNotFound) {
-        auto newHost = std::make_unique<HostInformation>(hostName, maxRequestsInFlightPerHost);
-        host = newHost.get();
-        m_hosts.add(hostName, WTFMove(newHost));
+        host = new HostInformation(hostName, maxRequestsInFlightPerHost);
+        m_hosts.add(hostName, host);
     }
     return host;
 }
 
 WebResourceLoadScheduler::WebResourceLoadScheduler()
-    : m_nonHTTPProtocolHost(String(), maxRequestsInFlightForNonHTTPProtocols)
+    : m_nonHTTPProtocolHost(new HostInformation(String(), maxRequestsInFlightForNonHTTPProtocols))
     , m_requestTimer(*this, &WebResourceLoadScheduler::requestTimerFired)
     , m_suspendPendingRequestsCount(0)
     , m_isSerialLoadingEnabled(false)
@@ -97,7 +96,7 @@
 {
     RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options);
     if (loader)
-        scheduleLoad(*loader);
+        scheduleLoad(loader.get());
 #if PLATFORM(IOS)
     // Since we defer loader initialization until scheduling on iOS, the frame
     // load delegate that would be called in SubresourceLoader::create() on
@@ -119,35 +118,36 @@
 {
     RefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request);
     if (loader)
-        scheduleLoad(*loader);
+        scheduleLoad(loader.get());
     return loader;
 }
 
-void WebResourceLoadScheduler::scheduleLoad(ResourceLoader& resourceLoader)
+void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader)
 {
-    LOG(ResourceLoading, "WebResourceLoadScheduler::load resource %p '%s'", &resourceLoader, resourceLoader.url().string().latin1().data());
+    ASSERT(resourceLoader);
 
+    LOG(ResourceLoading, "WebResourceLoadScheduler::load resource %p '%s'", resourceLoader, resourceLoader->url().string().latin1().data());
+
 #if PLATFORM(IOS)
     // If there's a web archive resource for this URL, we don't need to schedule the load since it will never touch the network.
-    if (!isSuspendingPendingRequests() && resourceLoader.documentLoader()->archiveResourceForURL(resourceLoader.iOSOriginalRequest().url())) {
-        resourceLoader.startLoading();
+    if (!isSuspendingPendingRequests() && resourceLoader->documentLoader()->archiveResourceForURL(resourceLoader->iOSOriginalRequest().url())) {
+        resourceLoader->startLoading();
         return;
     }
 #else
-    if (resourceLoader.documentLoader()->archiveResourceForURL(resourceLoader.request().url())) {
-        resourceLoader.start();
+    if (resourceLoader->documentLoader()->archiveResourceForURL(resourceLoader->request().url())) {
+        resourceLoader->start();
         return;
     }
 #endif
 
 #if PLATFORM(IOS)
-    HostInformation* host = hostForURL(resourceLoader.iOSOriginalRequest().url(), CreateIfNotFound);
+    HostInformation* host = hostForURL(resourceLoader->iOSOriginalRequest().url(), CreateIfNotFound);
 #else
-    HostInformation* host = hostForURL(resourceLoader.url(), CreateIfNotFound);
+    HostInformation* host = hostForURL(resourceLoader->url(), CreateIfNotFound);
 #endif
-    ASSERT(host);
 
-    ResourceLoadPriority priority = resourceLoader.request().priority();
+    ResourceLoadPriority priority = resourceLoader->request().priority();
 
     bool hadRequests = host->hasRequests();
     host->schedule(resourceLoader, priority);
@@ -156,21 +156,21 @@
     if (ResourceRequest::resourcePrioritiesEnabled() && !isSuspendingPendingRequests()) {
         // Serve all requests at once to keep the pipeline full at the network layer.
         // FIXME: Does this code do anything useful, given that we also set maxRequestsInFlightPerHost to effectively unlimited on these platforms?
-        servePendingRequests(*host, ResourceLoadPriority::VeryLow);
+        servePendingRequests(host, ResourceLoadPriority::VeryLow);
         return;
     }
 #endif
 
 #if PLATFORM(IOS)
-    if ((priority > ResourceLoadPriority::Low || !resourceLoader.iOSOriginalRequest().url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low && !hadRequests)) && !isSuspendingPendingRequests()) {
+    if ((priority > ResourceLoadPriority::Low || !resourceLoader->iOSOriginalRequest().url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low && !hadRequests)) && !isSuspendingPendingRequests()) {
         // Try to request important resources immediately.
-        servePendingRequests(*host, priority);
+        servePendingRequests(host, priority);
         return;
     }
 #else
-    if (priority > ResourceLoadPriority::Low || !resourceLoader.url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low && !hadRequests)) {
+    if (priority > ResourceLoadPriority::Low || !resourceLoader->url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low && !hadRequests)) {
         // Try to request important resources immediately.
-        servePendingRequests(*host, priority);
+        servePendingRequests(host, priority);
         return;
     }
 #endif
@@ -180,16 +180,18 @@
     scheduleServePendingRequests();
 }
 
-void WebResourceLoadScheduler::remove(ResourceLoader& resourceLoader)
+void WebResourceLoadScheduler::remove(ResourceLoader* resourceLoader)
 {
-    HostInformation* host = hostForURL(resourceLoader.url());
+    ASSERT(resourceLoader);
+
+    HostInformation* host = hostForURL(resourceLoader->url());
     if (host)
         host->remove(resourceLoader);
 #if PLATFORM(IOS)
     // ResourceLoader::url() doesn't start returning the correct value until the load starts. If we get canceled before that, we need to look for originalRequest url instead.
     // FIXME: ResourceLoader::url() should be made to return a sensible value at all times.
-    if (!resourceLoader.iOSOriginalRequest().isNull()) {
-        HostInformation* originalHost = hostForURL(resourceLoader.iOSOriginalRequest().url());
+    if (!resourceLoader->iOSOriginalRequest().isNull()) {
+        HostInformation* originalHost = hostForURL(resourceLoader->iOSOriginalRequest().url());
         if (originalHost && originalHost != host)
             originalHost->remove(resourceLoader);
     }
@@ -197,19 +199,18 @@
     scheduleServePendingRequests();
 }
 
-void WebResourceLoadScheduler::setDefersLoading(ResourceLoader&, bool)
+void WebResourceLoadScheduler::setDefersLoading(ResourceLoader*, bool)
 {
 }
 
-void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader& resourceLoader, const URL& redirectURL)
+void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader* resourceLoader, const URL& redirectURL)
 {
-    HostInformation* oldHost = hostForURL(resourceLoader.url());
+    HostInformation* oldHost = hostForURL(resourceLoader->url());
     ASSERT(oldHost);
     if (!oldHost)
         return;
 
     HostInformation* newHost = hostForURL(redirectURL, CreateIfNotFound);
-    ASSERT(newHost);
 
     if (oldHost->name() == newHost->name())
         return;
@@ -229,38 +230,36 @@
     servePendingRequests(m_nonHTTPProtocolHost, minimumPriority);
 
     Vector<HostInformation*> hostsToServe;
-    hostsToServe.reserveInitialCapacity(m_hosts.size());
-    for (const auto& host : m_hosts.values())
-        hostsToServe.uncheckedAppend(host.get());
+    copyValuesToVector(m_hosts, hostsToServe);
 
     for (auto* host : hostsToServe) {
         if (host->hasRequests())
-            servePendingRequests(*host, minimumPriority);
+            servePendingRequests(host, minimumPriority);
         else
-            m_hosts.remove(host->name());
+            delete m_hosts.take(host->name());
     }
 }
 
-void WebResourceLoadScheduler::servePendingRequests(HostInformation& host, ResourceLoadPriority minimumPriority)
+void WebResourceLoadScheduler::servePendingRequests(HostInformation* host, ResourceLoadPriority minimumPriority)
 {
-    LOG(ResourceLoading, "WebResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host.name().latin1().data());
+    LOG(ResourceLoading, "WebResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host->name().latin1().data());
 
     auto priority = ResourceLoadPriority::Highest;
     while (true) {
-        auto& requestsPending = host.requestsPending(priority);
+        auto& requestsPending = host->requestsPending(priority);
         while (!requestsPending.isEmpty()) {
-            Ref<ResourceLoader> resourceLoader = requestsPending.first().copyRef();
+            RefPtr<ResourceLoader> resourceLoader = requestsPending.first();
 
             // For named hosts - which are only http(s) hosts - we should always enforce the connection limit.
             // For non-named hosts - everything but http(s) - we should only enforce the limit if the document isn't done parsing 
             // and we don't know all stylesheets yet.
             Document* document = resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame().document() : 0;
-            bool shouldLimitRequests = !host.name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded()));
-            if (shouldLimitRequests && host.limitRequests(priority))
+            bool shouldLimitRequests = !host->name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded()));
+            if (shouldLimitRequests && host->limitRequests(priority))
                 return;
 
             requestsPending.removeFirst();
-            host.addLoadInProgress(resourceLoader.get());
+            host->addLoadInProgress(resourceLoader.get());
 #if PLATFORM(IOS)
             if (!IOSApplication::isWebProcess()) {
                 resourceLoader->startLoading();
@@ -286,7 +285,7 @@
     --m_suspendPendingRequestsCount;
     if (m_suspendPendingRequestsCount)
         return;
-    if (!m_hosts.isEmpty() || m_nonHTTPProtocolHost.hasRequests())
+    if (!m_hosts.isEmpty() || m_nonHTTPProtocolHost->hasRequests())
         scheduleServePendingRequests();
 }
     
@@ -332,18 +331,18 @@
     return 0;
 }
 
-void WebResourceLoadScheduler::HostInformation::schedule(ResourceLoader& resourceLoader, ResourceLoadPriority priority)
+void WebResourceLoadScheduler::HostInformation::schedule(ResourceLoader* resourceLoader, ResourceLoadPriority priority)
 {
     m_requestsPending[priorityToIndex(priority)].append(resourceLoader);
 }
     
-void WebResourceLoadScheduler::HostInformation::addLoadInProgress(ResourceLoader& resourceLoader)
+void WebResourceLoadScheduler::HostInformation::addLoadInProgress(ResourceLoader* resourceLoader)
 {
-    LOG(ResourceLoading, "HostInformation '%s' loading '%s'. Current count %d", m_name.latin1().data(), resourceLoader.url().string().latin1().data(), m_requestsLoading.size());
+    LOG(ResourceLoading, "HostInformation '%s' loading '%s'. Current count %d", m_name.latin1().data(), resourceLoader->url().string().latin1().data(), m_requestsLoading.size());
     m_requestsLoading.add(resourceLoader);
 }
     
-void WebResourceLoadScheduler::HostInformation::remove(ResourceLoader& resourceLoader)
+void WebResourceLoadScheduler::HostInformation::remove(ResourceLoader* resourceLoader)
 {
     if (m_requestsLoading.remove(resourceLoader))
         return;
@@ -350,7 +349,7 @@
     
     for (auto& requestQueue : m_requestsPending) {
         for (auto it = requestQueue.begin(), end = requestQueue.end(); it != end; ++it) {
-            if (it->ptr() == &resourceLoader) {
+            if (*it == resourceLoader) {
                 requestQueue.remove(it);
                 return;
             }

Modified: trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h (203078 => 203079)


--- trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h	2016-07-11 20:11:03 UTC (rev 203079)
@@ -20,7 +20,8 @@
     Boston, MA 02110-1301, USA.
  */
 
-#pragma once
+#ifndef WebResourceLoadScheduler_h
+#define WebResourceLoadScheduler_h
 
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/LoaderStrategy.h>
@@ -46,9 +47,9 @@
 
     RefPtr<WebCore::SubresourceLoader> loadResource(WebCore::Frame&, WebCore::CachedResource&, const WebCore::ResourceRequest&, const WebCore::ResourceLoaderOptions&) override;
     void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>&) override;
-    void remove(WebCore::ResourceLoader&) override;
-    void setDefersLoading(WebCore::ResourceLoader&, bool) override;
-    void crossOriginRedirectReceived(WebCore::ResourceLoader&, const WebCore::URL& redirectURL) override;
+    void remove(WebCore::ResourceLoader*) override;
+    void setDefersLoading(WebCore::ResourceLoader*, bool) override;
+    void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL& redirectURL) override;
     
     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority = WebCore::ResourceLoadPriority::VeryLow) override;
     void suspendPendingRequests() override;
@@ -65,7 +66,7 @@
     virtual ~WebResourceLoadScheduler();
 
 private:
-    void scheduleLoad(WebCore::ResourceLoader&);
+    void scheduleLoad(WebCore::ResourceLoader*);
     void scheduleServePendingRequests();
     void requestTimerFired();
 
@@ -78,13 +79,13 @@
         ~HostInformation();
         
         const String& name() const { return m_name; }
-        void schedule(WebCore::ResourceLoader&, WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriority::VeryLow);
-        void addLoadInProgress(WebCore::ResourceLoader&);
-        void remove(WebCore::ResourceLoader&);
+        void schedule(WebCore::ResourceLoader*, WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriority::VeryLow);
+        void addLoadInProgress(WebCore::ResourceLoader*);
+        void remove(WebCore::ResourceLoader*);
         bool hasRequests() const;
         bool limitRequests(WebCore::ResourceLoadPriority) const;
 
-        typedef Deque<Ref<WebCore::ResourceLoader>> RequestQueue;
+        typedef Deque<RefPtr<WebCore::ResourceLoader>> RequestQueue;
         RequestQueue& requestsPending(WebCore::ResourceLoadPriority priority) { return m_requestsPending[priorityToIndex(priority)]; }
 
     private:
@@ -91,7 +92,7 @@
         static unsigned priorityToIndex(WebCore::ResourceLoadPriority);
 
         std::array<RequestQueue, WebCore::resourceLoadPriorityCount> m_requestsPending;
-        typedef HashSet<Ref<WebCore::ResourceLoader>> RequestMap;
+        typedef HashSet<RefPtr<WebCore::ResourceLoader>> RequestMap;
         RequestMap m_requestsLoading;
         const String m_name;
         const unsigned m_maxRequestsInFlight;
@@ -103,10 +104,11 @@
     };
     
     HostInformation* hostForURL(const WebCore::URL&, CreateHostPolicy = FindOnly);
-    void servePendingRequests(HostInformation&, WebCore::ResourceLoadPriority);
+    WEBCORE_EXPORT void servePendingRequests(HostInformation*, WebCore::ResourceLoadPriority);
 
-    HashMap<String, std::unique_ptr<HostInformation>> m_hosts;
-    HostInformation m_nonHTTPProtocolHost;
+    typedef HashMap<String, HostInformation*, StringHash> HostMap;
+    HostMap m_hosts;
+    HostInformation* m_nonHTTPProtocolHost;
         
     WebCore::Timer m_requestTimer;
 
@@ -113,3 +115,5 @@
     unsigned m_suspendPendingRequestsCount;
     bool m_isSerialLoadingEnabled;
 };
+
+#endif

Modified: trunk/Source/WebKit2/ChangeLog (203078 => 203079)


--- trunk/Source/WebKit2/ChangeLog	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-11 20:11:03 UTC (rev 203079)
@@ -1,3 +1,17 @@
+2016-07-11  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r203064.
+        https://bugs.webkit.org/show_bug.cgi?id=159642
+
+        This change causes LayoutTest crashes on WK1 ASan (Requested
+        by ryanhaddad on #webkit).
+
+        Reverted changeset:
+
+        "Use refs for ResourceLoaders"
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
 2016-07-11  Nan Wang  <n_w...@apple.com>
 
         AX: WKWebView should have API to prevent pinch-to-zoom always being allowed

Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp (203078 => 203079)


--- trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp	2016-07-11 20:11:03 UTC (rev 203079)
@@ -217,19 +217,17 @@
 
 void WebLoaderStrategy::scheduleInternallyFailedLoad(WebCore::ResourceLoader& resourceLoader)
 {
-    m_internallyFailedResourceLoaders.add(resourceLoader);
+    m_internallyFailedResourceLoaders.add(&resourceLoader);
     m_internallyFailedLoadTimer.startOneShot(0);
 }
 
 void WebLoaderStrategy::internallyFailedLoadTimerFired()
 {
-    Vector<Ref<ResourceLoader>> internallyFailedResourceLoaders;
-    internallyFailedResourceLoaders.reserveInitialCapacity(m_internallyFailedResourceLoaders.size());
-    for (auto& loader : m_internallyFailedResourceLoaders)
-        internallyFailedResourceLoaders.uncheckedAppend(loader.copyRef());
+    Vector<RefPtr<ResourceLoader>> internallyFailedResourceLoaders;
+    copyToVector(m_internallyFailedResourceLoaders, internallyFailedResourceLoaders);
     
-    for (auto& loader : internallyFailedResourceLoaders)
-        loader->didFail(internalError(loader->url()));
+    for (size_t i = 0; i < internallyFailedResourceLoaders.size(); ++i)
+        internallyFailedResourceLoaders[i]->didFail(internalError(internallyFailedResourceLoaders[i]->url()));
 }
 
 void WebLoaderStrategy::startLocalLoad(WebCore::ResourceLoader& resourceLoader)
@@ -238,9 +236,10 @@
     m_webResourceLoaders.set(resourceLoader.identifier(), WebResourceLoader::create(resourceLoader));
 }
 
-void WebLoaderStrategy::remove(ResourceLoader& resourceLoader)
+void WebLoaderStrategy::remove(ResourceLoader* resourceLoader)
 {
-    LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::remove, url '%s'", resourceLoader.url().string().utf8().data());
+    ASSERT(resourceLoader);
+    LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::remove, url '%s'", resourceLoader->url().string().utf8().data());
 
     if (m_internallyFailedResourceLoaders.contains(resourceLoader)) {
         m_internallyFailedResourceLoaders.remove(resourceLoader);
@@ -247,7 +246,7 @@
         return;
     }
     
-    ResourceLoadIdentifier identifier = resourceLoader.identifier();
+    ResourceLoadIdentifier identifier = resourceLoader->identifier();
     if (!identifier) {
         LOG_ERROR("WebLoaderStrategy removing a ResourceLoader that has no identifier.");
         return;
@@ -265,13 +264,13 @@
     loader->detachFromCoreLoader();
 }
 
-void WebLoaderStrategy::setDefersLoading(ResourceLoader& resourceLoader, bool defers)
+void WebLoaderStrategy::setDefersLoading(ResourceLoader* resourceLoader, bool defers)
 {
-    ResourceLoadIdentifier identifier = resourceLoader.identifier();
+    ResourceLoadIdentifier identifier = resourceLoader->identifier();
     WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetDefersLoading(identifier, defers), 0);
 }
 
-void WebLoaderStrategy::crossOriginRedirectReceived(ResourceLoader&, const URL&)
+void WebLoaderStrategy::crossOriginRedirectReceived(ResourceLoader*, const URL&)
 {
     // We handle cross origin redirects entirely within the NetworkProcess.
     // We override this call in the WebProcess to make it a no-op.

Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.h (203078 => 203079)


--- trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.h	2016-07-11 19:50:40 UTC (rev 203078)
+++ trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.h	2016-07-11 20:11:03 UTC (rev 203079)
@@ -46,9 +46,9 @@
     RefPtr<WebCore::SubresourceLoader> loadResource(WebCore::Frame&, WebCore::CachedResource&, const WebCore::ResourceRequest&, const WebCore::ResourceLoaderOptions&) override;
     void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) override;
 
-    void remove(WebCore::ResourceLoader&) override;
-    void setDefersLoading(WebCore::ResourceLoader&, bool) override;
-    void crossOriginRedirectReceived(WebCore::ResourceLoader&, const WebCore::URL& redirectURL) override;
+    void remove(WebCore::ResourceLoader*) override;
+    void setDefersLoading(WebCore::ResourceLoader*, bool) override;
+    void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL& redirectURL) override;
     
     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority) override;
 
@@ -68,7 +68,7 @@
     void internallyFailedLoadTimerFired();
     void startLocalLoad(WebCore::ResourceLoader&);
 
-    HashSet<Ref<WebCore::ResourceLoader>> m_internallyFailedResourceLoaders;
+    HashSet<RefPtr<WebCore::ResourceLoader>> m_internallyFailedResourceLoaders;
     RunLoop::Timer<WebLoaderStrategy> m_internallyFailedLoadTimer;
     
     HashMap<unsigned long, RefPtr<WebResourceLoader>> m_webResourceLoaders;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to