<!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>[187533] 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/187533">187533</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2015-07-28 18:26:49 -0700 (Tue, 28 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean up usesAsyncCallbacks handling in ResourceHandle
https://bugs.webkit.org/show_bug.cgi?id=147342

Reviewed by Darin Adler.

Source/WebCore:

Store &quot;usesAsyncCallbacks&quot; bit in ResourceHandle, because it's not accessible
via client once the client is zeroed out.

Changed ResourceHandle::setClient into ResourceHandle::clearClient, because it's
only ever used to zero out the client pointer, and it doesn't support changing it.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::releaseResources):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::stopLoading):
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
(WebCore::BlobResourceHandle::notifyResponseOnError):
* platform/network/ResourceHandle.cpp:
(WebCore::ResourceHandle::client):
(WebCore::ResourceHandle::clearClient):
(WebCore::ResourceHandle::setDefersLoading):
(WebCore::ResourceHandle::usesAsyncCallbacks):
(WebCore::ResourceHandle::setClient): Deleted.
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::shouldUseCredentialStorage):
(WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::makeDelegate):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::continueWillSendRequest):
(WebCore::ResourceHandle::continueDidReceiveResponse):
(WebCore::ResourceHandle::shouldUseCredentialStorage):
(WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
(WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
(WebCore::ResourceHandle::continueWillCacheResponse):

Source/WebKit2:

Update for a renaming in WebCore.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::cleanup):
* Shared/Downloads/soup/DownloadSoup.cpp:
(WebKit::Download::platformInvalidate):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobResourceHandlecpp">trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandlecpp">trunk/Source/WebCore/platform/network/ResourceHandle.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleInternalh">trunk/Source/WebCore/platform/network/ResourceHandleInternal.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp">trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/ChangeLog        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2015-07-28  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Clean up usesAsyncCallbacks handling in ResourceHandle
+        https://bugs.webkit.org/show_bug.cgi?id=147342
+
+        Reviewed by Darin Adler.
+
+        Store &quot;usesAsyncCallbacks&quot; bit in ResourceHandle, because it's not accessible
+        via client once the client is zeroed out.
+
+        Changed ResourceHandle::setClient into ResourceHandle::clearClient, because it's
+        only ever used to zero out the client pointer, and it doesn't support changing it.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::releaseResources):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::stopLoading):
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+        (WebCore::BlobResourceHandle::notifyResponseOnError):
+        * platform/network/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::client):
+        (WebCore::ResourceHandle::clearClient):
+        (WebCore::ResourceHandle::setDefersLoading):
+        (WebCore::ResourceHandle::usesAsyncCallbacks):
+        (WebCore::ResourceHandle::setClient): Deleted.
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::createCFURLConnection):
+        (WebCore::ResourceHandle::willSendRequest):
+        (WebCore::ResourceHandle::shouldUseCredentialStorage):
+        (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::makeDelegate):
+        (WebCore::ResourceHandle::willSendRequest):
+        (WebCore::ResourceHandle::continueWillSendRequest):
+        (WebCore::ResourceHandle::continueDidReceiveResponse):
+        (WebCore::ResourceHandle::shouldUseCredentialStorage):
+        (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
+        (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
+        (WebCore::ResourceHandle::continueWillCacheResponse):
+
</ins><span class="cx"> 2015-07-28  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Minor cleanups in FontCacheFreeType.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">         // Clear out the ResourceHandle's client so that it doesn't try to call
</span><span class="cx">         // us back after we release it, unless it has been replaced by someone else.
</span><span class="cx">         if (m_handle-&gt;client() == this)
</span><del>-            m_handle-&gt;setClient(nullptr);
</del><ins>+            m_handle-&gt;clearClient();
</ins><span class="cx">         m_handle = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -324,7 +324,7 @@
</span><span class="cx">         ASSERT(!m_currentHandle);
</span><span class="cx"> 
</span><span class="cx">         ASSERT(m_manifestHandle-&gt;client() == this);
</span><del>-        m_manifestHandle-&gt;setClient(0);
</del><ins>+        m_manifestHandle-&gt;clearClient();
</ins><span class="cx"> 
</span><span class="cx">         m_manifestHandle-&gt;cancel();
</span><span class="cx">         m_manifestHandle = nullptr;
</span><span class="lines">@@ -335,7 +335,7 @@
</span><span class="cx">         ASSERT(m_cacheBeingUpdated);
</span><span class="cx"> 
</span><span class="cx">         ASSERT(m_currentHandle-&gt;client() == this);
</span><del>-        m_currentHandle-&gt;setClient(0);
</del><ins>+        m_currentHandle-&gt;clearClient();
</ins><span class="cx"> 
</span><span class="cx">         m_currentHandle-&gt;cancel();
</span><span class="cx">         m_currentHandle = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobResourceHandlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -594,7 +594,7 @@
</span><span class="cx">     // BlobResourceHandle cannot be used with downloading, and doesn't even wait for continueDidReceiveResponse.
</span><span class="cx">     // It's currently client's responsibility to know that didReceiveResponseAsync cannot be used to convert a
</span><span class="cx">     // load into a download or blobs.
</span><del>-    if (client()-&gt;usesAsyncCallbacks())
</del><ins>+    if (usesAsyncCallbacks())
</ins><span class="cx">         client()-&gt;didReceiveResponseAsync(this, response);
</span><span class="cx">     else
</span><span class="cx">         client()-&gt;didReceiveResponse(this, response);
</span><span class="lines">@@ -626,7 +626,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Note that we don't wait for continueDidReceiveResponse when using didReceiveResponseAsync.
</span><span class="cx">     // This is not formally correct, but the client has to be a no-op anyway, because blobs can't be downloaded.
</span><del>-    if (client()-&gt;usesAsyncCallbacks())
</del><ins>+    if (usesAsyncCallbacks())
</ins><span class="cx">         client()-&gt;didReceiveResponseAsync(this, response);
</span><span class="cx">     else
</span><span class="cx">         client()-&gt;didReceiveResponse(this, response);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -147,9 +147,9 @@
</span><span class="cx">     return d-&gt;m_client;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceHandle::setClient(ResourceHandleClient* client)
</del><ins>+void ResourceHandle::clearClient()
</ins><span class="cx"> {
</span><del>-    d-&gt;m_client = client;
</del><ins>+    d-&gt;m_client = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK) &amp;&amp; !USE(SOUP)
</span><span class="lines">@@ -239,4 +239,9 @@
</span><span class="cx">     platformSetDefersLoading(defers);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ResourceHandle::usesAsyncCallbacks() const
+{
+    return d-&gt;m_usesAsyncCallbacks;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx"> 
</span><span class="cx">     // The client may be 0, in which case no callbacks will be made.
</span><span class="cx">     ResourceHandleClient* client() const;
</span><del>-    WEBCORE_EXPORT void setClient(ResourceHandleClient*);
</del><ins>+    WEBCORE_EXPORT void clearClient();
</ins><span class="cx"> 
</span><span class="cx">     // Called in response to ResourceHandleClient::willSendRequestAsync().
</span><span class="cx">     WEBCORE_EXPORT void continueWillSendRequest(const ResourceRequest&amp;);
</span><span class="lines">@@ -250,6 +250,8 @@
</span><span class="cx"> protected:
</span><span class="cx">     ResourceHandle(NetworkingContext*, const ResourceRequest&amp;, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
</span><span class="cx"> 
</span><ins>+    bool usesAsyncCallbacks() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     enum FailureType {
</span><span class="cx">         NoFailure,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;NetworkingContext.h&quot;
</span><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><ins>+#include &quot;ResourceHandleClient.h&quot;
</ins><span class="cx"> #include &quot;ResourceRequest.h&quot;
</span><span class="cx"> #include &quot;AuthenticationChallenge.h&quot;
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="lines">@@ -70,8 +71,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class ResourceHandleClient;
-
</del><span class="cx">     class ResourceHandleInternal {
</span><span class="cx">         WTF_MAKE_NONCOPYABLE(ResourceHandleInternal); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx">     public:
</span><span class="lines">@@ -83,6 +82,7 @@
</span><span class="cx">             , status(0)
</span><span class="cx">             , m_defersLoading(defersLoading)
</span><span class="cx">             , m_shouldContentSniff(shouldContentSniff)
</span><ins>+            , m_usesAsyncCallbacks(client &amp;&amp; client-&gt;usesAsyncCallbacks())
</ins><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx">             , m_currentRequest(request)
</span><span class="cx"> #endif
</span><span class="lines">@@ -129,6 +129,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool m_defersLoading;
</span><span class="cx">         bool m_shouldContentSniff;
</span><ins>+        bool m_usesAsyncCallbacks;
</ins><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx">         RetainPtr&lt;CFURLConnectionRef&gt; m_connection;
</span><span class="cx">         ResourceRequest m_currentRequest;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -219,7 +219,7 @@
</span><span class="cx">     CFRelease(streamProperties);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    if (client() &amp;&amp; client()-&gt;usesAsyncCallbacks())
</del><ins>+    if (d-&gt;m_usesAsyncCallbacks)
</ins><span class="cx">         d-&gt;m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this));
</span><span class="cx">     else
</span><span class="cx">         d-&gt;m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;ResourceHandle&gt; protect(*this);
</span><del>-    if (client()-&gt;usesAsyncCallbacks())
</del><ins>+    if (d-&gt;m_usesAsyncCallbacks)
</ins><span class="cx">         client()-&gt;willSendRequestAsync(this, request, redirectResponse);
</span><span class="cx">     else {
</span><span class="cx">         client()-&gt;willSendRequest(this, request, redirectResponse);
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(Network, &quot;CFNet - shouldUseCredentialStorage()&quot;);
</span><span class="cx">     if (ResourceHandleClient* client = this-&gt;client()) {
</span><del>-        ASSERT(!client-&gt;usesAsyncCallbacks());
</del><ins>+        ASSERT(!d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx">         return client-&gt;shouldUseCredentialStorage(this);
</span><span class="cx">     }
</span><span class="cx">     return false;
</span><span class="lines">@@ -418,13 +418,16 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace&amp; protectionSpace)
</span><span class="cx"> {
</span><del>-    if (ResourceHandleClient* client = this-&gt;client()) {
-        if (client-&gt;usesAsyncCallbacks())
</del><ins>+    ResourceHandleClient* client = this-&gt;client();
+    if (d-&gt;m_usesAsyncCallbacks) {
+        if (client)
</ins><span class="cx">             client-&gt;canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace);
</span><span class="cx">         else
</span><del>-            return client-&gt;canAuthenticateAgainstProtectionSpace(this, protectionSpace);
</del><ins>+            continueCanAuthenticateAgainstProtectionSpace(false);
+        return false; // Ignored by caller.
</ins><span class="cx">     }
</span><del>-    return false;
</del><ins>+
+    return client &amp;&amp; client-&gt;canAuthenticateAgainstProtectionSpace(this, protectionSpace);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (client() &amp;&amp; client()-&gt;usesAsyncCallbacks()) {
</del><ins>+    if (d-&gt;m_usesAsyncCallbacks) {
</ins><span class="cx">         ASSERT(!scheduled);
</span><span class="cx">         [connection() setDelegateQueue:operationQueueForAsyncClients()];
</span><span class="cx">         scheduled = true;
</span><span class="lines">@@ -351,7 +351,7 @@
</span><span class="cx">     ASSERT(!d-&gt;m_delegate);
</span><span class="cx"> 
</span><span class="cx">     id &lt;NSURLConnectionDelegate&gt; delegate;
</span><del>-    if (client() &amp;&amp; client()-&gt;usesAsyncCallbacks()) {
</del><ins>+    if (d-&gt;m_usesAsyncCallbacks) {
</ins><span class="cx">         if (shouldUseCredentialStorage)
</span><span class="cx">             delegate = [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this];
</span><span class="cx">         else
</span><span class="lines">@@ -488,7 +488,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (client()-&gt;usesAsyncCallbacks()) {
</del><ins>+    if (d-&gt;m_usesAsyncCallbacks) {
</ins><span class="cx">         client()-&gt;willSendRequestAsync(this, request, redirectResponse);
</span><span class="cx">     } else {
</span><span class="cx">         Ref&lt;ResourceHandle&gt; protect(*this);
</span><span class="lines">@@ -502,8 +502,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandle::continueWillSendRequest(const ResourceRequest&amp; request)
</span><span class="cx"> {
</span><del>-    ASSERT(client());
-    ASSERT(client()-&gt;usesAsyncCallbacks());
</del><ins>+    ASSERT(d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx"> 
</span><span class="cx">     // Client call may not preserve the session, especially if the request is sent over IPC.
</span><span class="cx">     ResourceRequest newRequest = request;
</span><span class="lines">@@ -514,15 +513,14 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandle::continueDidReceiveResponse()
</span><span class="cx"> {
</span><del>-    ASSERT(client());
-    ASSERT(client()-&gt;usesAsyncCallbacks());
</del><ins>+    ASSERT(d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx"> 
</span><span class="cx">     [delegate() continueDidReceiveResponse];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ResourceHandle::shouldUseCredentialStorage()
</span><span class="cx"> {
</span><del>-    ASSERT(!client()-&gt;usesAsyncCallbacks());
</del><ins>+    ASSERT(!d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx">     return client() &amp;&amp; client()-&gt;shouldUseCredentialStorage(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -631,17 +629,21 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace&amp; protectionSpace)
</span><span class="cx"> {
</span><del>-    if (client()-&gt;usesAsyncCallbacks()) {
-        client()-&gt;canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace);
</del><ins>+    ResourceHandleClient* client = this-&gt;client();
+    if (d-&gt;m_usesAsyncCallbacks) {
+        if (client)
+            client-&gt;canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace);
+        else
+            continueCanAuthenticateAgainstProtectionSpace(false);
</ins><span class="cx">         return false; // Ignored by caller.
</span><del>-    } else
-        return client() &amp;&amp; client()-&gt;canAuthenticateAgainstProtectionSpace(this, protectionSpace);
</del><ins>+    }
+
+    return client &amp;&amp; client-&gt;canAuthenticateAgainstProtectionSpace(this, protectionSpace);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool result)
</span><span class="cx"> {
</span><del>-    ASSERT(client());
-    ASSERT(client()-&gt;usesAsyncCallbacks());
</del><ins>+    ASSERT(d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx"> 
</span><span class="cx">     [(id)delegate() continueCanAuthenticateAgainstProtectionSpace:result];
</span><span class="cx"> }
</span><span class="lines">@@ -728,8 +730,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response)
</span><span class="cx"> {
</span><del>-    ASSERT(client());
-    ASSERT(client()-&gt;usesAsyncCallbacks());
</del><ins>+    ASSERT(d-&gt;m_usesAsyncCallbacks);
</ins><span class="cx"> 
</span><span class="cx">     [(id)delegate() continueWillCacheResponse:response];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-07-28  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Clean up usesAsyncCallbacks handling in ResourceHandle
+        https://bugs.webkit.org/show_bug.cgi?id=147342
+
+        Reviewed by Darin Adler.
+
+        Update for a renaming in WebCore.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::cleanup):
+        * Shared/Downloads/soup/DownloadSoup.cpp:
+        (WebKit::Download::platformInvalidate):
+
</ins><span class="cx"> 2015-07-28  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: iOS: VoiceOver hangs indefinitely when an JS alert appears
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -205,7 +205,7 @@
</span><span class="cx">     invalidateSandboxExtensions();
</span><span class="cx"> 
</span><span class="cx">     if (m_handle) {
</span><del>-        m_handle-&gt;setClient(nullptr);
</del><ins>+        m_handle-&gt;clearClient();
</ins><span class="cx">         m_handle = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp (187532 => 187533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2015-07-29 00:57:00 UTC (rev 187532)
+++ trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2015-07-29 01:26:49 UTC (rev 187533)
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx"> void Download::platformInvalidate()
</span><span class="cx"> {
</span><span class="cx">     if (m_resourceHandle) {
</span><del>-        m_resourceHandle-&gt;setClient(0);
</del><ins>+        m_resourceHandle-&gt;clearClient();
</ins><span class="cx">         m_resourceHandle-&gt;cancel();
</span><span class="cx">         m_resourceHandle = nullptr;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>