Commit 7d30b67c authored by ap@apple.com's avatar ap@apple.com

[Mac] Move NSOperationQueue out of NetworkingContext

        https://bugs.webkit.org/show_bug.cgi?id=112970

        Reviewed by Brady Eidson.

        WebCore clients do not need explicit control over what queue ResourceHandle works on,
        they just want to avoid blocking main thread.

        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::usesAsyncCallbacks): Added. The name doesn't quite
        match what ResourceHandleMac currently does, but it will very soon.

        * platform/network/NetworkingContext.h:
        (WebCore::NetworkingContext::scheduledRunLoopPairs):
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::operationQueueForAsyncClients):
        (WebCore::ResourceHandle::start):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0e839e2f
2013-03-21 Alexey Proskuryakov <ap@apple.com>
[Mac] Move NSOperationQueue out of NetworkingContext
https://bugs.webkit.org/show_bug.cgi?id=112970
Reviewed by Brady Eidson.
WebCore clients do not need explicit control over what queue ResourceHandle works on,
they just want to avoid blocking main thread.
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::usesAsyncCallbacks): Added. The name doesn't quite
match what ResourceHandleMac currently does, but it will very soon.
* platform/network/NetworkingContext.h:
(WebCore::NetworkingContext::scheduledRunLoopPairs):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::operationQueueForAsyncClients):
(WebCore::ResourceHandle::start):
2013-03-21 Marja Hölttä <marja@chromium.org>
[V8] Generate specialized callbacks for the main world
......@@ -76,7 +76,6 @@ public:
virtual bool needsSiteSpecificQuirks() const = 0;
virtual bool localFileContentSniffingEnabled() const = 0; // FIXME: Reconcile with ResourceHandle::forceContentSniffing().
virtual SchedulePairHashSet* scheduledRunLoopPairs() const { return 0; }
virtual NSOperationQueue *scheduledOperationQueue() const { return 0; }
virtual RetainPtr<CFDataRef> sourceApplicationAuditData() const = 0;
virtual ResourceError blockedError(const ResourceRequest&) const = 0;
#endif
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2013 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -59,7 +60,7 @@ namespace WebCore {
ResourceHandleClient();
virtual ~ResourceHandleClient();
// request may be modified
// Request may be modified.
virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/) { }
virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
......@@ -74,6 +75,8 @@ namespace WebCore {
virtual void wasBlocked(ResourceHandle*) { }
virtual void cannotShowURL(ResourceHandle*) { }
virtual bool usesAsyncCallbacks() { return false; }
#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
virtual bool supportsDataArray() { return false; }
virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef) { }
......
......@@ -130,6 +130,17 @@ static void applyBasicAuthorizationHeader(ResourceRequest& request, const Creden
request.addHTTPHeaderField("Authorization", authenticationHeader);
}
static NSOperationQueue *operationQueueForAsyncClients()
{
static NSOperationQueue *queue;
if (!queue) {
queue = [[NSOperationQueue alloc] init];
// Default concurrent operation count depends on current system workload, but delegate methods are mostly idling in IPC, so we can run as many as needed.
[queue setMaxConcurrentOperationCount:NSIntegerMax];
}
return queue;
}
ResourceHandleInternal::~ResourceHandleInternal()
{
}
......@@ -235,9 +246,9 @@ bool ResourceHandle::start()
}
}
if (NSOperationQueue *operationQueue = d->m_context->scheduledOperationQueue()) {
if (client() && client()->usesAsyncCallbacks()) {
ASSERT(!scheduled);
[connection() setDelegateQueue:operationQueue];
[connection() setDelegateQueue:operationQueueForAsyncClients()];
scheduled = true;
}
......
2013-03-21 Alexey Proskuryakov <ap@apple.com>
[Mac] Move NSOperationQueue out of NetworkingContext
https://bugs.webkit.org/show_bug.cgi?id=112970
Reviewed by Brady Eidson.
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/mac/RemoteNetworkingContext.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
Tell ResourceHandle to use an operation queue in the new way.
2013-03-21 Timothy Hatcher <timothy@apple.com>
Support connecting the Web Inspector without showing it.
......@@ -73,6 +73,7 @@ public:
virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE;
virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE;
virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE;
virtual bool usesAsyncCallbacks() OVERRIDE { return true; }
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
virtual bool canAuthenticateAgainstProtectionSpace(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) OVERRIDE;
......
......@@ -54,7 +54,6 @@ private:
virtual bool needsSiteSpecificQuirks() const OVERRIDE;
virtual bool localFileContentSniffingEnabled() const OVERRIDE;
virtual WebCore::NetworkStorageSession& storageSession() const OVERRIDE;
virtual NSOperationQueue *scheduledOperationQueue() const OVERRIDE;
virtual RetainPtr<CFDataRef> sourceApplicationAuditData() const OVERRIDE;
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const OVERRIDE;
......
......@@ -90,17 +90,6 @@ NetworkStorageSession& RemoteNetworkingContext::privateBrowsingSession()
return *privateBrowsingStorageSession();
}
NSOperationQueue *RemoteNetworkingContext::scheduledOperationQueue() const
{
static NSOperationQueue *queue;
if (!queue) {
queue = [[NSOperationQueue alloc] init];
// Default concurrent operation count depends on current system workload, but delegate methods are mostly idling in IPC, so we can run as many as needed.
[queue setMaxConcurrentOperationCount:NSIntegerMax];
}
return queue;
}
RetainPtr<CFDataRef> RemoteNetworkingContext::sourceApplicationAuditData() const
{
return nil;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment