OSDN Git Service

Merge WebKit at r72805: Cherry-pick WebKit change 73062
authorSteve Block <steveblock@google.com>
Wed, 5 Jan 2011 14:52:42 +0000 (14:52 +0000)
committerSteve Block <steveblock@google.com>
Thu, 6 Jan 2011 14:22:59 +0000 (14:22 +0000)
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
WebCore/platform/network/android/CookieJarAndroid.cpp
WebCore/platform/network/android/ProxyServerAndroid.cpp [new file with mode: 0644]
WebCore/platform/network/android/ResourceHandleAndroid.cpp
WebCore/platform/network/android/ResourceRequestAndroid.cpp

index a7d40dc..e0cb4c5 100644 (file)
@@ -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() { }
 };
index dd324c5..f3b343e 100644 (file)
 
 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 (file)
index 0000000..2f813b5
--- /dev/null
@@ -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<ProxyServer> proxyServersForURL(const KURL&, const NetworkingContext*)
+{
+    notImplemented();
+    return Vector<ProxyServer>();
+}
+
+}
index d3a8a17..8837cf8 100644 (file)
@@ -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 <wtf/text/CString.h>
 
 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<ResourceLoaderAndroid> loader = ResourceLoaderAndroid::start(this, d->m_request, frame->loader()->client(), isMainResource, false);
+    MainResourceLoader* mainLoader = context->mainResourceLoader();
+    bool isMainResource = static_cast<void*>(mainLoader) == static_cast<void*>(client());
+    RefPtr<ResourceLoaderAndroid> 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<char>* m_data;
 };
 
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
-        StoredCredentials /*storedCredentials*/,
-        ResourceError& error, ResourceResponse& response, WTF::Vector<char>& data,
-        Frame* frame) 
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request,
+        StoredCredentials, ResourceError& error, ResourceResponse& response, WTF::Vector<char>& data)
 {
     SyncLoader s(error, response, data);
-    RefPtr<ResourceHandle> h = adoptRef(new ResourceHandle(request, &s, false, false, false));
+    RefPtr<ResourceHandle> 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
index 7f4bccb..00735f3 100644 (file)
@@ -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