From e18e365d7948d9e0444d5ed418f78d12c6544fd8 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 5 Jan 2011 14:52:42 +0000 Subject: [PATCH] Merge WebKit at r72805: Cherry-pick WebKit change 73062 This change is the upstreaming of local changes in WebCore/platform/network. It did not generate conflicts in the merge to r73109 as both upstream and local versions matched at r73109. But since it appears after r72805, it was inadvertantly removed as part of the initial merge by Git to r72805. See http://trac.webkit.org/changeset/73062 Note that this is a backwards merge from Chromium release 9.0.600.0 to 9.0.597.0, to align with the Chromium 9 stable release branch. Change-Id: I6a266e1270cbc1f155065ae1c56c491ccf33e497 --- WebCore/platform/network/NetworkingContext.h | 9 +++++ .../platform/network/android/CookieJarAndroid.cpp | 16 ++++----- .../network/android/ProxyServerAndroid.cpp | 40 ++++++++++++++++++++++ .../network/android/ResourceHandleAndroid.cpp | 32 ++++++++--------- .../network/android/ResourceRequestAndroid.cpp | 7 ++++ 5 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 WebCore/platform/network/android/ProxyServerAndroid.cpp diff --git a/WebCore/platform/network/NetworkingContext.h b/WebCore/platform/network/NetworkingContext.h index a7d40dc15..e0cb4c5d2 100644 --- a/WebCore/platform/network/NetworkingContext.h +++ b/WebCore/platform/network/NetworkingContext.h @@ -33,6 +33,10 @@ class QNetworkAccessManager; namespace WebCore { +#if PLATFORM(ANDROID) +class FrameLoaderClient; +class MainResourceLoader; +#endif class ResourceError; class ResourceRequest; @@ -60,6 +64,11 @@ public: virtual ResourceError blockedError(const ResourceRequest&) const = 0; #endif +#if PLATFORM(ANDROID) + virtual MainResourceLoader* mainResourceLoader() const = 0; + virtual FrameLoaderClient* frameLoaderClient() const = 0; +#endif + protected: NetworkingContext() { } }; diff --git a/WebCore/platform/network/android/CookieJarAndroid.cpp b/WebCore/platform/network/android/CookieJarAndroid.cpp index dd324c5c7..f3b343e06 100644 --- a/WebCore/platform/network/android/CookieJarAndroid.cpp +++ b/WebCore/platform/network/android/CookieJarAndroid.cpp @@ -31,25 +31,25 @@ namespace WebCore { -void setCookies(Document*, const KURL& url, const String& value) +void setCookies(Document* document, const KURL& url, const String& value) { - PlatformBridge::setCookies(url, value); + PlatformBridge::setCookies(document, url, value); } -String cookies(const Document*, const KURL& url) +String cookies(const Document* document, const KURL& url) { - return PlatformBridge::cookies(url); + return PlatformBridge::cookies(document, url); } -String cookieRequestHeaderFieldValue(const Document*, const KURL& url) +String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) { // FIXME: include HttpOnly cookie. - return PlatformBridge::cookies(url); + return PlatformBridge::cookies(document, url); } -bool cookiesEnabled(const Document*) +bool cookiesEnabled(const Document* document) { - return PlatformBridge::cookiesEnabled(); + return PlatformBridge::cookiesEnabled(document); } } diff --git a/WebCore/platform/network/android/ProxyServerAndroid.cpp b/WebCore/platform/network/android/ProxyServerAndroid.cpp new file mode 100644 index 000000000..2f813b51d --- /dev/null +++ b/WebCore/platform/network/android/ProxyServerAndroid.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 2010, The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ProxyServer.h" + +#include "NotImplemented.h" + +namespace WebCore { + +Vector proxyServersForURL(const KURL&, const NetworkingContext*) +{ + notImplemented(); + return Vector(); +} + +} diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp index d3a8a17b6..8837cf8ca 100644 --- a/WebCore/platform/network/android/ResourceHandleAndroid.cpp +++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp @@ -24,7 +24,6 @@ */ #include "config.h" - #include "ResourceHandle.h" #include "CachedResourceLoader.h" @@ -36,6 +35,7 @@ #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include "ResourceLoaderAndroid.h" +#include "Settings.h" #include namespace WebCore { @@ -48,16 +48,14 @@ ResourceHandle::~ResourceHandle() { } -bool ResourceHandle::start(Frame* frame) +bool ResourceHandle::start(NetworkingContext* context) { - DocumentLoader* documentLoader = frame->loader()->activeDocumentLoader(); - MainResourceLoader* mainLoader = documentLoader->mainResourceLoader(); - bool isMainResource = mainLoader && (mainLoader->handle() == this); - - PassRefPtr loader = ResourceLoaderAndroid::start(this, d->m_request, frame->loader()->client(), isMainResource, false); + MainResourceLoader* mainLoader = context->mainResourceLoader(); + bool isMainResource = static_cast(mainLoader) == static_cast(client()); + RefPtr loader = ResourceLoaderAndroid::start(this, d->m_firstRequest, context->frameLoaderClient(), isMainResource, false); if (loader) { - d->m_loader = loader; + d->m_loader = loader.release(); return true; } @@ -110,11 +108,11 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*) return ResourceLoaderAndroid::willLoadFromCache(request.url(), formData ? formData->identifier() : 0); } -bool ResourceHandle::loadsBlocked() +bool ResourceHandle::loadsBlocked() { // FIXME, need to check whether connection pipe is blocked. // return false for now - return false; + return false; } // Class to handle synchronized loading of resources. @@ -149,15 +147,17 @@ private: WTF::Vector* m_data; }; -void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, - StoredCredentials /*storedCredentials*/, - ResourceError& error, ResourceResponse& response, WTF::Vector& data, - Frame* frame) +void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, + StoredCredentials, ResourceError& error, ResourceResponse& response, WTF::Vector& data) { SyncLoader s(error, response, data); - RefPtr h = adoptRef(new ResourceHandle(request, &s, false, false, false)); + RefPtr h = adoptRef(new ResourceHandle(request, &s, false, false)); // This blocks until the load is finished. - ResourceLoaderAndroid::start(h.get(), request, frame->loader()->client(), false, true); + // Use the request owned by the ResourceHandle. This has had the username + // and password (if present) stripped from the URL in + // ResourceHandleInternal::ResourceHandleInternal(). This matches the + // behaviour in the asynchronous case. + ResourceLoaderAndroid::start(h.get(), request, context->frameLoaderClient(), false, true); } } // namespace WebCore diff --git a/WebCore/platform/network/android/ResourceRequestAndroid.cpp b/WebCore/platform/network/android/ResourceRequestAndroid.cpp index 7f4bccbfb..00735f354 100644 --- a/WebCore/platform/network/android/ResourceRequestAndroid.cpp +++ b/WebCore/platform/network/android/ResourceRequestAndroid.cpp @@ -30,10 +30,17 @@ namespace WebCore { unsigned initializeMaximumHTTPConnectionCountPerHost() { +#if USE(CHROME_NETWORK_STACK) + // The chromium network stack already handles limiting the number of + // parallel requests per host, so there's no need to do it here. Therefore, + // this is set to a high value that should never be hit in practice. + return 10000; +#else // This is used by the loader to control the number of parallel load // requests. Our java framework has 4 threads that can each pipeline up to // 5 requests. Use 20 as a maximum number. return 20; +#endif } } // namespace WebCore -- 2.11.0