<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203079] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203079">203079</a></dd>
<dt>Author</dt> <dd>ryanhaddad@apple.com</dd>
<dt>Date</dt> <dd>2016-07-11 13:11:03 -0700 (Mon, 11 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/203064">r203064</a>.
https://bugs.webkit.org/show_bug.cgi?id=159642

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

Reverted changeset:

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

Patch by Commit Queue &lt;commit-queue@webkit.org&gt; on 2016-07-11</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderLoaderStrategyh">trunk/Source/WebCore/loader/LoaderStrategy.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebCoreSupportWebResourceLoadSchedulercpp">trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.cpp</a></li>
<li><a href="#trunkSourceWebKitWebCoreSupportWebResourceLoadSchedulerh">trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp">trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebLoaderStrategyh">trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-07-11  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        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:
+
+        &quot;Use refs for ResourceLoaders&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
</ins><span class="cx"> 2016-07-11  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebGL] Check for existing buffer exists for enabled vertex array attributes before permitting glDrawArrays to execute
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderLoaderStrategyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/LoaderStrategy.h (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -51,9 +51,9 @@
</span><span class="cx">     virtual RefPtr&lt;SubresourceLoader&gt; loadResource(Frame&amp;, CachedResource&amp;, const ResourceRequest&amp;, const ResourceLoaderOptions&amp;) = 0;
</span><span class="cx">     virtual void loadResourceSynchronously(NetworkingContext*, unsigned long identifier, const ResourceRequest&amp;, StoredCredentials, ClientCredentialPolicy, ResourceError&amp;, ResourceResponse&amp;, Vector&lt;char&gt;&amp; data) = 0;
</span><span class="cx"> 
</span><del>-    virtual void remove(ResourceLoader&amp;) = 0;
-    virtual void setDefersLoading(ResourceLoader&amp;, bool) = 0;
-    virtual void crossOriginRedirectReceived(ResourceLoader&amp;, const URL&amp; redirectURL) = 0;
</del><ins>+    virtual void remove(ResourceLoader*) = 0;
+    virtual void setDefersLoading(ResourceLoader*, bool) = 0;
+    virtual void crossOriginRedirectReceived(ResourceLoader*, const URL&amp; redirectURL) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void servePendingRequests(ResourceLoadPriority minimumPriority = ResourceLoadPriority::VeryLow) = 0;
</span><span class="cx">     virtual void suspendPendingRequests() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoader::finishNetworkLoad()
</span><span class="cx"> {
</span><del>-    platformStrategies()-&gt;loaderStrategy()-&gt;remove(*this);
</del><ins>+    platformStrategies()-&gt;loaderStrategy()-&gt;remove(this);
</ins><span class="cx"> 
</span><span class="cx">     if (m_handle) {
</span><span class="cx">         ASSERT(m_handle-&gt;client() == this);
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">         start();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    platformStrategies()-&gt;loaderStrategy()-&gt;setDefersLoading(*this, defers);
</del><ins>+    platformStrategies()-&gt;loaderStrategy()-&gt;setDefersLoading(this, defers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FrameLoader* ResourceLoader::frameLoader() const
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx"> void ResourceLoader::willSwitchToSubstituteResource()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_documentLoader-&gt;isSubstituteLoadPending(this));
</span><del>-    platformStrategies()-&gt;loaderStrategy()-&gt;remove(*this);
</del><ins>+    platformStrategies()-&gt;loaderStrategy()-&gt;remove(this);
</ins><span class="cx">     if (m_handle)
</span><span class="cx">         m_handle-&gt;cancel();
</span><span class="cx"> }
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool isRedirect = !redirectResponse.isNull();
</span><span class="cx">     if (isRedirect)
</span><del>-        platformStrategies()-&gt;loaderStrategy()-&gt;crossOriginRedirectReceived(*this, request.url());
</del><ins>+        platformStrategies()-&gt;loaderStrategy()-&gt;crossOriginRedirectReceived(this, request.url());
</ins><span class="cx"> 
</span><span class="cx">     m_request = request;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-07-11  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        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:
+
+        &quot;Use refs for ResourceLoaders&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
</ins><span class="cx"> 2016-07-08  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Use refs for ResourceLoaders
</span></span></pre></div>
<a id="trunkSourceWebKitWebCoreSupportWebResourceLoadSchedulercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.cpp (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -67,21 +67,20 @@
</span><span class="cx"> WebResourceLoadScheduler::HostInformation* WebResourceLoadScheduler::hostForURL(const URL&amp; url, CreateHostPolicy createHostPolicy)
</span><span class="cx"> {
</span><span class="cx">     if (!url.protocolIsInHTTPFamily())
</span><del>-        return &amp;m_nonHTTPProtocolHost;
</del><ins>+        return m_nonHTTPProtocolHost;
</ins><span class="cx"> 
</span><span class="cx">     m_hosts.checkConsistency();
</span><span class="cx">     String hostName = url.host();
</span><span class="cx">     HostInformation* host = m_hosts.get(hostName);
</span><span class="cx">     if (!host &amp;&amp; createHostPolicy == CreateIfNotFound) {
</span><del>-        auto newHost = std::make_unique&lt;HostInformation&gt;(hostName, maxRequestsInFlightPerHost);
-        host = newHost.get();
-        m_hosts.add(hostName, WTFMove(newHost));
</del><ins>+        host = new HostInformation(hostName, maxRequestsInFlightPerHost);
+        m_hosts.add(hostName, host);
</ins><span class="cx">     }
</span><span class="cx">     return host;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebResourceLoadScheduler::WebResourceLoadScheduler()
</span><del>-    : m_nonHTTPProtocolHost(String(), maxRequestsInFlightForNonHTTPProtocols)
</del><ins>+    : m_nonHTTPProtocolHost(new HostInformation(String(), maxRequestsInFlightForNonHTTPProtocols))
</ins><span class="cx">     , m_requestTimer(*this, &amp;WebResourceLoadScheduler::requestTimerFired)
</span><span class="cx">     , m_suspendPendingRequestsCount(0)
</span><span class="cx">     , m_isSerialLoadingEnabled(false)
</span><span class="lines">@@ -97,7 +96,7 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;SubresourceLoader&gt; loader = SubresourceLoader::create(frame, resource, request, options);
</span><span class="cx">     if (loader)
</span><del>-        scheduleLoad(*loader);
</del><ins>+        scheduleLoad(loader.get());
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // Since we defer loader initialization until scheduling on iOS, the frame
</span><span class="cx">     // load delegate that would be called in SubresourceLoader::create() on
</span><span class="lines">@@ -119,35 +118,36 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;NetscapePlugInStreamLoader&gt; loader = NetscapePlugInStreamLoader::create(frame, client, request);
</span><span class="cx">     if (loader)
</span><del>-        scheduleLoad(*loader);
</del><ins>+        scheduleLoad(loader.get());
</ins><span class="cx">     return loader;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::scheduleLoad(ResourceLoader&amp; resourceLoader)
</del><ins>+void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader)
</ins><span class="cx"> {
</span><del>-    LOG(ResourceLoading, &quot;WebResourceLoadScheduler::load resource %p '%s'&quot;, &amp;resourceLoader, resourceLoader.url().string().latin1().data());
</del><ins>+    ASSERT(resourceLoader);
</ins><span class="cx"> 
</span><ins>+    LOG(ResourceLoading, &quot;WebResourceLoadScheduler::load resource %p '%s'&quot;, resourceLoader, resourceLoader-&gt;url().string().latin1().data());
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // 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.
</span><del>-    if (!isSuspendingPendingRequests() &amp;&amp; resourceLoader.documentLoader()-&gt;archiveResourceForURL(resourceLoader.iOSOriginalRequest().url())) {
-        resourceLoader.startLoading();
</del><ins>+    if (!isSuspendingPendingRequests() &amp;&amp; resourceLoader-&gt;documentLoader()-&gt;archiveResourceForURL(resourceLoader-&gt;iOSOriginalRequest().url())) {
+        resourceLoader-&gt;startLoading();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><del>-    if (resourceLoader.documentLoader()-&gt;archiveResourceForURL(resourceLoader.request().url())) {
-        resourceLoader.start();
</del><ins>+    if (resourceLoader-&gt;documentLoader()-&gt;archiveResourceForURL(resourceLoader-&gt;request().url())) {
+        resourceLoader-&gt;start();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    HostInformation* host = hostForURL(resourceLoader.iOSOriginalRequest().url(), CreateIfNotFound);
</del><ins>+    HostInformation* host = hostForURL(resourceLoader-&gt;iOSOriginalRequest().url(), CreateIfNotFound);
</ins><span class="cx"> #else
</span><del>-    HostInformation* host = hostForURL(resourceLoader.url(), CreateIfNotFound);
</del><ins>+    HostInformation* host = hostForURL(resourceLoader-&gt;url(), CreateIfNotFound);
</ins><span class="cx"> #endif
</span><del>-    ASSERT(host);
</del><span class="cx"> 
</span><del>-    ResourceLoadPriority priority = resourceLoader.request().priority();
</del><ins>+    ResourceLoadPriority priority = resourceLoader-&gt;request().priority();
</ins><span class="cx"> 
</span><span class="cx">     bool hadRequests = host-&gt;hasRequests();
</span><span class="cx">     host-&gt;schedule(resourceLoader, priority);
</span><span class="lines">@@ -156,21 +156,21 @@
</span><span class="cx">     if (ResourceRequest::resourcePrioritiesEnabled() &amp;&amp; !isSuspendingPendingRequests()) {
</span><span class="cx">         // Serve all requests at once to keep the pipeline full at the network layer.
</span><span class="cx">         // FIXME: Does this code do anything useful, given that we also set maxRequestsInFlightPerHost to effectively unlimited on these platforms?
</span><del>-        servePendingRequests(*host, ResourceLoadPriority::VeryLow);
</del><ins>+        servePendingRequests(host, ResourceLoadPriority::VeryLow);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if ((priority &gt; ResourceLoadPriority::Low || !resourceLoader.iOSOriginalRequest().url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low &amp;&amp; !hadRequests)) &amp;&amp; !isSuspendingPendingRequests()) {
</del><ins>+    if ((priority &gt; ResourceLoadPriority::Low || !resourceLoader-&gt;iOSOriginalRequest().url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low &amp;&amp; !hadRequests)) &amp;&amp; !isSuspendingPendingRequests()) {
</ins><span class="cx">         // Try to request important resources immediately.
</span><del>-        servePendingRequests(*host, priority);
</del><ins>+        servePendingRequests(host, priority);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><del>-    if (priority &gt; ResourceLoadPriority::Low || !resourceLoader.url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low &amp;&amp; !hadRequests)) {
</del><ins>+    if (priority &gt; ResourceLoadPriority::Low || !resourceLoader-&gt;url().protocolIsInHTTPFamily() || (priority == ResourceLoadPriority::Low &amp;&amp; !hadRequests)) {
</ins><span class="cx">         // Try to request important resources immediately.
</span><del>-        servePendingRequests(*host, priority);
</del><ins>+        servePendingRequests(host, priority);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -180,16 +180,18 @@
</span><span class="cx">     scheduleServePendingRequests();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::remove(ResourceLoader&amp; resourceLoader)
</del><ins>+void WebResourceLoadScheduler::remove(ResourceLoader* resourceLoader)
</ins><span class="cx"> {
</span><del>-    HostInformation* host = hostForURL(resourceLoader.url());
</del><ins>+    ASSERT(resourceLoader);
+
+    HostInformation* host = hostForURL(resourceLoader-&gt;url());
</ins><span class="cx">     if (host)
</span><span class="cx">         host-&gt;remove(resourceLoader);
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // 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.
</span><span class="cx">     // FIXME: ResourceLoader::url() should be made to return a sensible value at all times.
</span><del>-    if (!resourceLoader.iOSOriginalRequest().isNull()) {
-        HostInformation* originalHost = hostForURL(resourceLoader.iOSOriginalRequest().url());
</del><ins>+    if (!resourceLoader-&gt;iOSOriginalRequest().isNull()) {
+        HostInformation* originalHost = hostForURL(resourceLoader-&gt;iOSOriginalRequest().url());
</ins><span class="cx">         if (originalHost &amp;&amp; originalHost != host)
</span><span class="cx">             originalHost-&gt;remove(resourceLoader);
</span><span class="cx">     }
</span><span class="lines">@@ -197,19 +199,18 @@
</span><span class="cx">     scheduleServePendingRequests();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::setDefersLoading(ResourceLoader&amp;, bool)
</del><ins>+void WebResourceLoadScheduler::setDefersLoading(ResourceLoader*, bool)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader&amp; resourceLoader, const URL&amp; redirectURL)
</del><ins>+void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader* resourceLoader, const URL&amp; redirectURL)
</ins><span class="cx"> {
</span><del>-    HostInformation* oldHost = hostForURL(resourceLoader.url());
</del><ins>+    HostInformation* oldHost = hostForURL(resourceLoader-&gt;url());
</ins><span class="cx">     ASSERT(oldHost);
</span><span class="cx">     if (!oldHost)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     HostInformation* newHost = hostForURL(redirectURL, CreateIfNotFound);
</span><del>-    ASSERT(newHost);
</del><span class="cx"> 
</span><span class="cx">     if (oldHost-&gt;name() == newHost-&gt;name())
</span><span class="cx">         return;
</span><span class="lines">@@ -229,38 +230,36 @@
</span><span class="cx">     servePendingRequests(m_nonHTTPProtocolHost, minimumPriority);
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;HostInformation*&gt; hostsToServe;
</span><del>-    hostsToServe.reserveInitialCapacity(m_hosts.size());
-    for (const auto&amp; host : m_hosts.values())
-        hostsToServe.uncheckedAppend(host.get());
</del><ins>+    copyValuesToVector(m_hosts, hostsToServe);
</ins><span class="cx"> 
</span><span class="cx">     for (auto* host : hostsToServe) {
</span><span class="cx">         if (host-&gt;hasRequests())
</span><del>-            servePendingRequests(*host, minimumPriority);
</del><ins>+            servePendingRequests(host, minimumPriority);
</ins><span class="cx">         else
</span><del>-            m_hosts.remove(host-&gt;name());
</del><ins>+            delete m_hosts.take(host-&gt;name());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::servePendingRequests(HostInformation&amp; host, ResourceLoadPriority minimumPriority)
</del><ins>+void WebResourceLoadScheduler::servePendingRequests(HostInformation* host, ResourceLoadPriority minimumPriority)
</ins><span class="cx"> {
</span><del>-    LOG(ResourceLoading, &quot;WebResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'&quot;, host.name().latin1().data());
</del><ins>+    LOG(ResourceLoading, &quot;WebResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'&quot;, host-&gt;name().latin1().data());
</ins><span class="cx"> 
</span><span class="cx">     auto priority = ResourceLoadPriority::Highest;
</span><span class="cx">     while (true) {
</span><del>-        auto&amp; requestsPending = host.requestsPending(priority);
</del><ins>+        auto&amp; requestsPending = host-&gt;requestsPending(priority);
</ins><span class="cx">         while (!requestsPending.isEmpty()) {
</span><del>-            Ref&lt;ResourceLoader&gt; resourceLoader = requestsPending.first().copyRef();
</del><ins>+            RefPtr&lt;ResourceLoader&gt; resourceLoader = requestsPending.first();
</ins><span class="cx"> 
</span><span class="cx">             // For named hosts - which are only http(s) hosts - we should always enforce the connection limit.
</span><span class="cx">             // For non-named hosts - everything but http(s) - we should only enforce the limit if the document isn't done parsing 
</span><span class="cx">             // and we don't know all stylesheets yet.
</span><span class="cx">             Document* document = resourceLoader-&gt;frameLoader() ? resourceLoader-&gt;frameLoader()-&gt;frame().document() : 0;
</span><del>-            bool shouldLimitRequests = !host.name().isNull() || (document &amp;&amp; (document-&gt;parsing() || !document-&gt;haveStylesheetsLoaded()));
-            if (shouldLimitRequests &amp;&amp; host.limitRequests(priority))
</del><ins>+            bool shouldLimitRequests = !host-&gt;name().isNull() || (document &amp;&amp; (document-&gt;parsing() || !document-&gt;haveStylesheetsLoaded()));
+            if (shouldLimitRequests &amp;&amp; host-&gt;limitRequests(priority))
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="cx">             requestsPending.removeFirst();
</span><del>-            host.addLoadInProgress(resourceLoader.get());
</del><ins>+            host-&gt;addLoadInProgress(resourceLoader.get());
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">             if (!IOSApplication::isWebProcess()) {
</span><span class="cx">                 resourceLoader-&gt;startLoading();
</span><span class="lines">@@ -286,7 +285,7 @@
</span><span class="cx">     --m_suspendPendingRequestsCount;
</span><span class="cx">     if (m_suspendPendingRequestsCount)
</span><span class="cx">         return;
</span><del>-    if (!m_hosts.isEmpty() || m_nonHTTPProtocolHost.hasRequests())
</del><ins>+    if (!m_hosts.isEmpty() || m_nonHTTPProtocolHost-&gt;hasRequests())
</ins><span class="cx">         scheduleServePendingRequests();
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="lines">@@ -332,18 +331,18 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebResourceLoadScheduler::HostInformation::schedule(ResourceLoader&amp; resourceLoader, ResourceLoadPriority priority)
</del><ins>+void WebResourceLoadScheduler::HostInformation::schedule(ResourceLoader* resourceLoader, ResourceLoadPriority priority)
</ins><span class="cx"> {
</span><span class="cx">     m_requestsPending[priorityToIndex(priority)].append(resourceLoader);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void WebResourceLoadScheduler::HostInformation::addLoadInProgress(ResourceLoader&amp; resourceLoader)
</del><ins>+void WebResourceLoadScheduler::HostInformation::addLoadInProgress(ResourceLoader* resourceLoader)
</ins><span class="cx"> {
</span><del>-    LOG(ResourceLoading, &quot;HostInformation '%s' loading '%s'. Current count %d&quot;, m_name.latin1().data(), resourceLoader.url().string().latin1().data(), m_requestsLoading.size());
</del><ins>+    LOG(ResourceLoading, &quot;HostInformation '%s' loading '%s'. Current count %d&quot;, m_name.latin1().data(), resourceLoader-&gt;url().string().latin1().data(), m_requestsLoading.size());
</ins><span class="cx">     m_requestsLoading.add(resourceLoader);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void WebResourceLoadScheduler::HostInformation::remove(ResourceLoader&amp; resourceLoader)
</del><ins>+void WebResourceLoadScheduler::HostInformation::remove(ResourceLoader* resourceLoader)
</ins><span class="cx"> {
</span><span class="cx">     if (m_requestsLoading.remove(resourceLoader))
</span><span class="cx">         return;
</span><span class="lines">@@ -350,7 +349,7 @@
</span><span class="cx">     
</span><span class="cx">     for (auto&amp; requestQueue : m_requestsPending) {
</span><span class="cx">         for (auto it = requestQueue.begin(), end = requestQueue.end(); it != end; ++it) {
</span><del>-            if (it-&gt;ptr() == &amp;resourceLoader) {
</del><ins>+            if (*it == resourceLoader) {
</ins><span class="cx">                 requestQueue.remove(it);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceWebKitWebCoreSupportWebResourceLoadSchedulerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -20,7 +20,8 @@
</span><span class="cx">     Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#pragma once
</del><ins>+#ifndef WebResourceLoadScheduler_h
+#define WebResourceLoadScheduler_h
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;WebCore/FrameLoaderTypes.h&gt;
</span><span class="cx"> #include &lt;WebCore/LoaderStrategy.h&gt;
</span><span class="lines">@@ -46,9 +47,9 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebCore::SubresourceLoader&gt; loadResource(WebCore::Frame&amp;, WebCore::CachedResource&amp;, const WebCore::ResourceRequest&amp;, const WebCore::ResourceLoaderOptions&amp;) override;
</span><span class="cx">     void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long, const WebCore::ResourceRequest&amp;, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&amp;, WebCore::ResourceResponse&amp;, Vector&lt;char&gt;&amp;) override;
</span><del>-    void remove(WebCore::ResourceLoader&amp;) override;
-    void setDefersLoading(WebCore::ResourceLoader&amp;, bool) override;
-    void crossOriginRedirectReceived(WebCore::ResourceLoader&amp;, const WebCore::URL&amp; redirectURL) override;
</del><ins>+    void remove(WebCore::ResourceLoader*) override;
+    void setDefersLoading(WebCore::ResourceLoader*, bool) override;
+    void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL&amp; redirectURL) override;
</ins><span class="cx">     
</span><span class="cx">     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority = WebCore::ResourceLoadPriority::VeryLow) override;
</span><span class="cx">     void suspendPendingRequests() override;
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx">     virtual ~WebResourceLoadScheduler();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void scheduleLoad(WebCore::ResourceLoader&amp;);
</del><ins>+    void scheduleLoad(WebCore::ResourceLoader*);
</ins><span class="cx">     void scheduleServePendingRequests();
</span><span class="cx">     void requestTimerFired();
</span><span class="cx"> 
</span><span class="lines">@@ -78,13 +79,13 @@
</span><span class="cx">         ~HostInformation();
</span><span class="cx">         
</span><span class="cx">         const String&amp; name() const { return m_name; }
</span><del>-        void schedule(WebCore::ResourceLoader&amp;, WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriority::VeryLow);
-        void addLoadInProgress(WebCore::ResourceLoader&amp;);
-        void remove(WebCore::ResourceLoader&amp;);
</del><ins>+        void schedule(WebCore::ResourceLoader*, WebCore::ResourceLoadPriority = WebCore::ResourceLoadPriority::VeryLow);
+        void addLoadInProgress(WebCore::ResourceLoader*);
+        void remove(WebCore::ResourceLoader*);
</ins><span class="cx">         bool hasRequests() const;
</span><span class="cx">         bool limitRequests(WebCore::ResourceLoadPriority) const;
</span><span class="cx"> 
</span><del>-        typedef Deque&lt;Ref&lt;WebCore::ResourceLoader&gt;&gt; RequestQueue;
</del><ins>+        typedef Deque&lt;RefPtr&lt;WebCore::ResourceLoader&gt;&gt; RequestQueue;
</ins><span class="cx">         RequestQueue&amp; requestsPending(WebCore::ResourceLoadPriority priority) { return m_requestsPending[priorityToIndex(priority)]; }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -91,7 +92,7 @@
</span><span class="cx">         static unsigned priorityToIndex(WebCore::ResourceLoadPriority);
</span><span class="cx"> 
</span><span class="cx">         std::array&lt;RequestQueue, WebCore::resourceLoadPriorityCount&gt; m_requestsPending;
</span><del>-        typedef HashSet&lt;Ref&lt;WebCore::ResourceLoader&gt;&gt; RequestMap;
</del><ins>+        typedef HashSet&lt;RefPtr&lt;WebCore::ResourceLoader&gt;&gt; RequestMap;
</ins><span class="cx">         RequestMap m_requestsLoading;
</span><span class="cx">         const String m_name;
</span><span class="cx">         const unsigned m_maxRequestsInFlight;
</span><span class="lines">@@ -103,10 +104,11 @@
</span><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     HostInformation* hostForURL(const WebCore::URL&amp;, CreateHostPolicy = FindOnly);
</span><del>-    void servePendingRequests(HostInformation&amp;, WebCore::ResourceLoadPriority);
</del><ins>+    WEBCORE_EXPORT void servePendingRequests(HostInformation*, WebCore::ResourceLoadPriority);
</ins><span class="cx"> 
</span><del>-    HashMap&lt;String, std::unique_ptr&lt;HostInformation&gt;&gt; m_hosts;
-    HostInformation m_nonHTTPProtocolHost;
</del><ins>+    typedef HashMap&lt;String, HostInformation*, StringHash&gt; HostMap;
+    HostMap m_hosts;
+    HostInformation* m_nonHTTPProtocolHost;
</ins><span class="cx">         
</span><span class="cx">     WebCore::Timer m_requestTimer;
</span><span class="cx"> 
</span><span class="lines">@@ -113,3 +115,5 @@
</span><span class="cx">     unsigned m_suspendPendingRequestsCount;
</span><span class="cx">     bool m_isSerialLoadingEnabled;
</span><span class="cx"> };
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-07-11  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        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:
+
+        &quot;Use refs for ResourceLoaders&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159592
+        http://trac.webkit.org/changeset/203064
+
</ins><span class="cx"> 2016-07-11  Nan Wang  &lt;n_wang@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -217,19 +217,17 @@
</span><span class="cx"> 
</span><span class="cx"> void WebLoaderStrategy::scheduleInternallyFailedLoad(WebCore::ResourceLoader&amp; resourceLoader)
</span><span class="cx"> {
</span><del>-    m_internallyFailedResourceLoaders.add(resourceLoader);
</del><ins>+    m_internallyFailedResourceLoaders.add(&amp;resourceLoader);
</ins><span class="cx">     m_internallyFailedLoadTimer.startOneShot(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebLoaderStrategy::internallyFailedLoadTimerFired()
</span><span class="cx"> {
</span><del>-    Vector&lt;Ref&lt;ResourceLoader&gt;&gt; internallyFailedResourceLoaders;
-    internallyFailedResourceLoaders.reserveInitialCapacity(m_internallyFailedResourceLoaders.size());
-    for (auto&amp; loader : m_internallyFailedResourceLoaders)
-        internallyFailedResourceLoaders.uncheckedAppend(loader.copyRef());
</del><ins>+    Vector&lt;RefPtr&lt;ResourceLoader&gt;&gt; internallyFailedResourceLoaders;
+    copyToVector(m_internallyFailedResourceLoaders, internallyFailedResourceLoaders);
</ins><span class="cx">     
</span><del>-    for (auto&amp; loader : internallyFailedResourceLoaders)
-        loader-&gt;didFail(internalError(loader-&gt;url()));
</del><ins>+    for (size_t i = 0; i &lt; internallyFailedResourceLoaders.size(); ++i)
+        internallyFailedResourceLoaders[i]-&gt;didFail(internalError(internallyFailedResourceLoaders[i]-&gt;url()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebLoaderStrategy::startLocalLoad(WebCore::ResourceLoader&amp; resourceLoader)
</span><span class="lines">@@ -238,9 +236,10 @@
</span><span class="cx">     m_webResourceLoaders.set(resourceLoader.identifier(), WebResourceLoader::create(resourceLoader));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebLoaderStrategy::remove(ResourceLoader&amp; resourceLoader)
</del><ins>+void WebLoaderStrategy::remove(ResourceLoader* resourceLoader)
</ins><span class="cx"> {
</span><del>-    LOG(NetworkScheduling, &quot;(WebProcess) WebLoaderStrategy::remove, url '%s'&quot;, resourceLoader.url().string().utf8().data());
</del><ins>+    ASSERT(resourceLoader);
+    LOG(NetworkScheduling, &quot;(WebProcess) WebLoaderStrategy::remove, url '%s'&quot;, resourceLoader-&gt;url().string().utf8().data());
</ins><span class="cx"> 
</span><span class="cx">     if (m_internallyFailedResourceLoaders.contains(resourceLoader)) {
</span><span class="cx">         m_internallyFailedResourceLoaders.remove(resourceLoader);
</span><span class="lines">@@ -247,7 +246,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    ResourceLoadIdentifier identifier = resourceLoader.identifier();
</del><ins>+    ResourceLoadIdentifier identifier = resourceLoader-&gt;identifier();
</ins><span class="cx">     if (!identifier) {
</span><span class="cx">         LOG_ERROR(&quot;WebLoaderStrategy removing a ResourceLoader that has no identifier.&quot;);
</span><span class="cx">         return;
</span><span class="lines">@@ -265,13 +264,13 @@
</span><span class="cx">     loader-&gt;detachFromCoreLoader();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebLoaderStrategy::setDefersLoading(ResourceLoader&amp; resourceLoader, bool defers)
</del><ins>+void WebLoaderStrategy::setDefersLoading(ResourceLoader* resourceLoader, bool defers)
</ins><span class="cx"> {
</span><del>-    ResourceLoadIdentifier identifier = resourceLoader.identifier();
</del><ins>+    ResourceLoadIdentifier identifier = resourceLoader-&gt;identifier();
</ins><span class="cx">     WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::SetDefersLoading(identifier, defers), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebLoaderStrategy::crossOriginRedirectReceived(ResourceLoader&amp;, const URL&amp;)
</del><ins>+void WebLoaderStrategy::crossOriginRedirectReceived(ResourceLoader*, const URL&amp;)
</ins><span class="cx"> {
</span><span class="cx">     // We handle cross origin redirects entirely within the NetworkProcess.
</span><span class="cx">     // We override this call in the WebProcess to make it a no-op.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebLoaderStrategyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.h (203078 => 203079)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,9 +46,9 @@
</span><span class="cx">     RefPtr&lt;WebCore::SubresourceLoader&gt; loadResource(WebCore::Frame&amp;, WebCore::CachedResource&amp;, const WebCore::ResourceRequest&amp;, const WebCore::ResourceLoaderOptions&amp;) override;
</span><span class="cx">     void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&amp;, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&amp;, WebCore::ResourceResponse&amp;, Vector&lt;char&gt;&amp; data) override;
</span><span class="cx"> 
</span><del>-    void remove(WebCore::ResourceLoader&amp;) override;
-    void setDefersLoading(WebCore::ResourceLoader&amp;, bool) override;
-    void crossOriginRedirectReceived(WebCore::ResourceLoader&amp;, const WebCore::URL&amp; redirectURL) override;
</del><ins>+    void remove(WebCore::ResourceLoader*) override;
+    void setDefersLoading(WebCore::ResourceLoader*, bool) override;
+    void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL&amp; redirectURL) override;
</ins><span class="cx">     
</span><span class="cx">     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority) override;
</span><span class="cx"> 
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     void internallyFailedLoadTimerFired();
</span><span class="cx">     void startLocalLoad(WebCore::ResourceLoader&amp;);
</span><span class="cx"> 
</span><del>-    HashSet&lt;Ref&lt;WebCore::ResourceLoader&gt;&gt; m_internallyFailedResourceLoaders;
</del><ins>+    HashSet&lt;RefPtr&lt;WebCore::ResourceLoader&gt;&gt; m_internallyFailedResourceLoaders;
</ins><span class="cx">     RunLoop::Timer&lt;WebLoaderStrategy&gt; m_internallyFailedLoadTimer;
</span><span class="cx">     
</span><span class="cx">     HashMap&lt;unsigned long, RefPtr&lt;WebResourceLoader&gt;&gt; m_webResourceLoaders;
</span></span></pre>
</div>
</div>

</body>
</html>