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