Title: [107854] trunk/Source
Revision
107854
Author
[email protected]
Date
2012-02-15 16:27:45 -0800 (Wed, 15 Feb 2012)

Log Message

[soup] Add support for multiple SoupSessions.
https://bugs.webkit.org/show_bug.cgi?id=77341

Source/WebCore:

Reviewed by Gustavo Noronha Silva.

Make the libsoup network backend support multiple SoupSessions. This is
accomplished by using the NetworkingContext classes, which now have a
`soupSession()' method when the libsoup backend is being used.

libsoup's ResourceHandle implementation now retrieves the SoupSession
via the NetworkingContext it receives instead of relying on
defaultSession(). defaultSession() is still used when a null
NetworkingContext is passed to ResourceHandle::start (for example, via
webkit_download_start).

The CookieJar implementation retrieves the SoupSession from the
NetworkingContext as much as possible as well -- the functions used by
WebKit2 could not be converted, though, as they seem to assume there is
only one shared cookie jar.

No new tests, covered by the existing ones.

* platform/network/NetworkingContext.h:
(NetworkingContext): Add soupSession() method if USE(SOUP) is set.
* platform/network/ResourceHandleInternal.h:
(ResourceHandleInternal):
* platform/network/soup/CookieJarSoup.cpp:
(WebCore::cookieJarForDocument):
(WebCore):
(WebCore::defaultCookieJar):
(WebCore::setCookies):
(WebCore::cookies):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandleInternal::soupSession): Add method to retrieve
a SoupSession from a NetworkingContext and fallback to defaultSession()
if there's no valid NetworkingContext.
(WebCore):
(WebCore::ensureSessionIsInitialized): Only change or use the default
cookie jar if the SoupSession being changed is the default one.
(WebCore::sendRequestCallback):
(WebCore::startHTTPRequest):
(WebCore::ResourceHandle::cancel):
(WebCore::startNonHTTPRequest):

Source/WebKit/efl:

Add the necessary infrastructure to support multiple SoupSessions. Each
WebView now has a "session" property, which defaults to
ResourceHandle::defaultSession() and can be changed to another
SoupSession by the user.

Some API in ewk_network and ewk_view which required SoupSession to be a
valid type in the headers has now been moved inside #if USE(SOUP)
ifdefs so we can actually the required Soup header and avoid build
problems with duplicate typedefs.

* CMakeListsEfl.txt:
* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::createNetworkingContext):
* WebCoreSupport/FrameNetworkingContextEfl.cpp: Copied from Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h.
(WebCore):
(WebCore::FrameNetworkingContextEfl::create):
(WebCore::FrameNetworkingContextEfl::FrameNetworkingContextEfl):
(WebCore::FrameNetworkingContextEfl::soupSession):
* WebCoreSupport/FrameNetworkingContextEfl.h:
(FrameNetworkingContextEfl):
* ewk/ewk_cookies.h: Mention this API is only valid with the
default SoupSession.
* ewk/ewk_network.cpp:
(ewk_network_default_soup_session_get): Define only if USE(SOUP) is set.
* ewk/ewk_network.h: Ditto, and mention this API is only valid with the
default SoupSession.
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):
(ewk_view_soup_session_get):
(ewk_view_soup_session_set):
* ewk/ewk_view.h:
():

Source/WebKit/gtk:

Reviewed by Gustavo Noronha Silva.

Adapt to the changes to FrameNetworkingContext in WebCore.

* GNUmakefile.am:
* WebCoreSupport/FrameNetworkingContextGtk.cpp: Copied from Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h.
(WebKit):
(WebKit::FrameNetworkingContextGtk::soupSession): Always return ResourceHandle::defaultSession().
* WebCoreSupport/FrameNetworkingContextGtk.h:
(FrameNetworkingContextGtk):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107853 => 107854)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 00:27:45 UTC (rev 107854)
@@ -1,3 +1,51 @@
+2012-01-31  Raphael Kubo da Costa  <[email protected]>
+
+        [soup] Add support for multiple SoupSessions.
+        https://bugs.webkit.org/show_bug.cgi?id=77341
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Make the libsoup network backend support multiple SoupSessions. This is
+        accomplished by using the NetworkingContext classes, which now have a
+        `soupSession()' method when the libsoup backend is being used.
+
+        libsoup's ResourceHandle implementation now retrieves the SoupSession
+        via the NetworkingContext it receives instead of relying on
+        defaultSession(). defaultSession() is still used when a null
+        NetworkingContext is passed to ResourceHandle::start (for example, via
+        webkit_download_start).
+
+        The CookieJar implementation retrieves the SoupSession from the
+        NetworkingContext as much as possible as well -- the functions used by
+        WebKit2 could not be converted, though, as they seem to assume there is
+        only one shared cookie jar.
+
+        No new tests, covered by the existing ones.
+
+        * platform/network/NetworkingContext.h:
+        (NetworkingContext): Add soupSession() method if USE(SOUP) is set.
+        * platform/network/ResourceHandleInternal.h:
+        (ResourceHandleInternal):
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::cookieJarForDocument):
+        (WebCore):
+        (WebCore::defaultCookieJar):
+        (WebCore::setCookies):
+        (WebCore::cookies):
+        (WebCore::cookieRequestHeaderFieldValue):
+        (WebCore::cookiesEnabled):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::ResourceHandleInternal::soupSession): Add method to retrieve
+        a SoupSession from a NetworkingContext and fallback to defaultSession()
+        if there's no valid NetworkingContext.
+        (WebCore):
+        (WebCore::ensureSessionIsInitialized): Only change or use the default
+        cookie jar if the SoupSession being changed is the default one.
+        (WebCore::sendRequestCallback):
+        (WebCore::startHTTPRequest):
+        (WebCore::ResourceHandle::cancel):
+        (WebCore::startNonHTTPRequest):
+
 2012-02-15  Anders Carlsson  <[email protected]>
 
         The TileCache object should be deallocated on the main thread

Modified: trunk/Source/WebCore/platform/network/NetworkingContext.h (107853 => 107854)


--- trunk/Source/WebCore/platform/network/NetworkingContext.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebCore/platform/network/NetworkingContext.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -35,6 +35,10 @@
 QT_END_NAMESPACE
 #endif
 
+#if USE(SOUP)
+typedef struct _SoupSession SoupSession;
+#endif
+
 namespace WebCore {
 
 class ResourceError;
@@ -66,6 +70,10 @@
     virtual ResourceError blockedError(const ResourceRequest&) const = 0;
 #endif
 
+#if USE(SOUP)
+    virtual SoupSession* soupSession() const = 0;
+#endif
+
 protected:
     NetworkingContext() { }
 };

Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (107853 => 107854)


--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -189,6 +189,7 @@
         unsigned long m_bodySize;
         unsigned long m_bodyDataSent;
         RefPtr<NetworkingContext> m_context;
+        SoupSession* soupSession();
 #endif
 #if PLATFORM(QT)
         QNetworkReplyHandler* m_job;

Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (107853 => 107854)


--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -23,8 +23,12 @@
 
 #include "Cookie.h"
 #include "Document.h"
+#include "Frame.h"
+#include "FrameLoader.h"
 #include "GOwnPtrSoup.h"
 #include "KURL.h"
+#include "NetworkingContext.h"
+#include "ResourceHandle.h"
 #include <wtf/text/CString.h>
 
 namespace WebCore {
@@ -32,6 +36,22 @@
 static bool cookiesInitialized;
 static SoupCookieJar* cookieJar;
 
+static SoupCookieJar* cookieJarForDocument(const Document* document)
+{
+    if (!document)
+        return 0;
+    const Frame* frame = document->frame();
+    if (!frame)
+        return 0;
+    const FrameLoader* loader = frame->loader();
+    if (!loader)
+        return 0;
+    const NetworkingContext* context = loader->networkingContext();
+    if (!context)
+        return 0;
+    return SOUP_COOKIE_JAR(soup_session_get_feature(context->soupSession(), SOUP_TYPE_COOKIE_JAR));
+}
+
 SoupCookieJar* defaultCookieJar()
 {
     if (!cookiesInitialized) {
@@ -59,7 +79,7 @@
 
 void setCookies(Document* document, const KURL& url, const String& value)
 {
-    SoupCookieJar* jar = defaultCookieJar();
+    SoupCookieJar* jar = cookieJarForDocument(document);
     if (!jar)
         return;
 
@@ -73,9 +93,9 @@
                                                 value.utf8().data());
 }
 
-String cookies(const Document* /*document*/, const KURL& url)
+String cookies(const Document* document, const KURL& url)
 {
-    SoupCookieJar* jar = defaultCookieJar();
+    SoupCookieJar* jar = cookieJarForDocument(document);
     if (!jar)
         return String();
 
@@ -89,9 +109,9 @@
     return result;
 }
 
-String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
 {
-    SoupCookieJar* jar = defaultCookieJar();
+    SoupCookieJar* jar = cookieJarForDocument(document);
     if (!jar)
         return String();
 
@@ -105,9 +125,9 @@
     return result;
 }
 
-bool cookiesEnabled(const Document* /*document*/)
+bool cookiesEnabled(const Document* document)
 {
-    return defaultCookieJar();
+    return !!cookieJarForDocument(document);
 }
 
 bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies)

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (107853 => 107854)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -141,6 +141,11 @@
 {
 }
 
+SoupSession* ResourceHandleInternal::soupSession()
+{
+    return (m_context && m_context->isValid()) ? m_context->soupSession() : ResourceHandle::defaultSession();
+}
+
 ResourceHandle::~ResourceHandle()
 {
     cleanupSoupRequestOperation(this, true);
@@ -151,11 +156,13 @@
     if (g_object_get_data(G_OBJECT(session), "webkit-init"))
         return;
 
-    SoupCookieJar* jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
-    if (!jar)
-        soup_session_add_feature(session, SOUP_SESSION_FEATURE(defaultCookieJar()));
-    else
-        setDefaultCookieJar(jar);
+    if (session == ResourceHandle::defaultSession()) {
+        SoupCookieJar* jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
+        if (!jar)
+            soup_session_add_feature(session, SOUP_SESSION_FEATURE(defaultCookieJar()));
+        else
+            setDefaultCookieJar(jar);
+    }
 
     if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER) && LogNetwork.state == WTFLogChannelOn) {
         SoupLogger* logger = soup_logger_new(static_cast<SoupLoggerLogLevel>(SOUP_LOGGER_LOG_BODY), -1);
@@ -319,7 +326,7 @@
         d->m_response.updateFromSoupMessage(soupMessage);
 
         if (d->m_defersLoading)
-            soup_session_pause_message(handle->defaultSession(), soupMessage);
+            soup_session_pause_message(d->soupSession(), soupMessage);
     } else {
         d->m_response.setURL(handle->firstRequest().url());
         const gchar* contentType = soup_request_get_content_type(d->m_soupRequest.get());
@@ -442,12 +449,12 @@
 {
     ASSERT(handle);
 
-    SoupSession* session = handle->defaultSession();
+    ResourceHandleInternal* d = handle->getInternal();
+
+    SoupSession* session = d->soupSession();
     ensureSessionIsInitialized(session);
     SoupRequester* requester = SOUP_REQUESTER(soup_session_get_feature(session, SOUP_TYPE_REQUESTER));
 
-    ResourceHandleInternal* d = handle->getInternal();
-
     ResourceRequest request(handle->firstRequest());
     KURL url(request.url());
     url.removeFragmentIdentifier();
@@ -552,7 +559,7 @@
 {
     d->m_cancelled = true;
     if (d->m_soupMessage)
-        soup_session_cancel_message(defaultSession(), d->m_soupMessage.get(), SOUP_STATUS_CANCELLED);
+        soup_session_cancel_message(d->soupSession(), d->m_soupMessage.get(), SOUP_STATUS_CANCELLED);
     else if (d->m_cancellable)
         g_cancellable_cancel(d->m_cancellable.get());
 }
@@ -687,10 +694,11 @@
     if (handle->firstRequest().httpMethod() != "GET" && handle->firstRequest().httpMethod() != "POST")
         return false;
 
-    SoupSession* session = handle->defaultSession();
+    ResourceHandleInternal* d = handle->getInternal();
+
+    SoupSession* session = d->soupSession();
     ensureSessionIsInitialized(session);
     SoupRequester* requester = SOUP_REQUESTER(soup_session_get_feature(session, SOUP_TYPE_REQUESTER));
-    ResourceHandleInternal* d = handle->getInternal();
 
     CString urlStr = url.string().utf8();
 

Modified: trunk/Source/WebKit/efl/CMakeListsEfl.txt (107853 => 107854)


--- trunk/Source/WebKit/efl/CMakeListsEfl.txt	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/CMakeListsEfl.txt	2012-02-16 00:27:45 UTC (rev 107854)
@@ -72,6 +72,7 @@
     efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
     efl/WebCoreSupport/EditorClientEfl.cpp
     efl/WebCoreSupport/FrameLoaderClientEfl.cpp
+    efl/WebCoreSupport/FrameNetworkingContextEfl.cpp
     efl/WebCoreSupport/FullscreenVideoControllerEfl.cpp
     efl/WebCoreSupport/IconDatabaseClientEfl.cpp
     efl/WebCoreSupport/StorageTrackerClientEfl.cpp

Modified: trunk/Source/WebKit/efl/ChangeLog (107853 => 107854)


--- trunk/Source/WebKit/efl/ChangeLog	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-02-16 00:27:45 UTC (rev 107854)
@@ -1,3 +1,42 @@
+2012-01-31  Raphael Kubo da Costa  <[email protected]>
+
+        [soup] Add support for multiple SoupSessions.
+        https://bugs.webkit.org/show_bug.cgi?id=77341
+
+        Add the necessary infrastructure to support multiple SoupSessions. Each
+        WebView now has a "session" property, which defaults to
+        ResourceHandle::defaultSession() and can be changed to another
+        SoupSession by the user.
+
+        Some API in ewk_network and ewk_view which required SoupSession to be a
+        valid type in the headers has now been moved inside #if USE(SOUP)
+        ifdefs so we can actually the required Soup header and avoid build
+        problems with duplicate typedefs.
+
+        * CMakeListsEfl.txt:
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::createNetworkingContext):
+        * WebCoreSupport/FrameNetworkingContextEfl.cpp: Copied from Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h.
+        (WebCore):
+        (WebCore::FrameNetworkingContextEfl::create):
+        (WebCore::FrameNetworkingContextEfl::FrameNetworkingContextEfl):
+        (WebCore::FrameNetworkingContextEfl::soupSession):
+        * WebCoreSupport/FrameNetworkingContextEfl.h:
+        (FrameNetworkingContextEfl):
+        * ewk/ewk_cookies.h: Mention this API is only valid with the
+        default SoupSession.
+        * ewk/ewk_network.cpp:
+        (ewk_network_default_soup_session_get): Define only if USE(SOUP) is set.
+        * ewk/ewk_network.h: Ditto, and mention this API is only valid with the
+        default SoupSession.
+        * ewk/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (_ewk_view_priv_new):
+        (ewk_view_soup_session_get):
+        (ewk_view_soup_session_set):
+        * ewk/ewk_view.h:
+        ():
+
 2012-02-15  Sadrul Habib Chowdhury  <[email protected]>
 
         Notify ChromeClient when touch-event handlers are installed/removed.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp (107853 => 107854)


--- trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -947,7 +947,7 @@
 
 PassRefPtr<FrameNetworkingContext> FrameLoaderClientEfl::createNetworkingContext()
 {
-    return FrameNetworkingContextEfl::create(EWKPrivate::coreFrame(m_frame));
+    return FrameNetworkingContextEfl::create(EWKPrivate::coreFrame(m_frame), m_frame);
 }
 
 }

Copied: trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.cpp (from rev 107852, trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h) (0 => 107854)


--- trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2010 Samsung Electronics
+ * Copyright (C) 2012 ProFUSION embedded systems
+ *
+ * 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 APPLE COMPUTER, INC. ``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 "FrameNetworkingContextEfl.h"
+
+#include "ResourceHandle.h"
+#include "ewk_frame.h"
+#include "ewk_view.h"
+
+#include <Evas.h>
+
+namespace WebCore {
+
+PassRefPtr<FrameNetworkingContextEfl> FrameNetworkingContextEfl::create(Frame* frame, Evas_Object* ewkFrame)
+{
+    return adoptRef(new FrameNetworkingContextEfl(frame, ewkFrame));
+}
+
+FrameNetworkingContextEfl::FrameNetworkingContextEfl(Frame* frame, Evas_Object* ewkFrame)
+    : FrameNetworkingContext(frame)
+    , m_ewkFrame(ewkFrame)
+{
+}
+
+SoupSession* FrameNetworkingContextEfl::soupSession() const
+{
+    return ewk_view_soup_session_get(ewk_frame_view_get(m_ewkFrame));
+}
+
+}

Modified: trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h (107853 => 107854)


--- trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -31,22 +31,21 @@
 
 #include "FrameNetworkingContext.h"
 
+typedef struct _Evas_Object Evas_Object;
+
 namespace WebCore {
 
 class FrameNetworkingContextEfl : public WebCore::FrameNetworkingContext {
 public:
-    static PassRefPtr<FrameNetworkingContextEfl> create(WebCore::Frame* frame)
-    {
-        return adoptRef(new FrameNetworkingContextEfl(frame));
-    }
+    static PassRefPtr<FrameNetworkingContextEfl> create(Frame*, Evas_Object*);
 
     WebCore::Frame* coreFrame() const { return frame(); }
+    virtual SoupSession* soupSession() const;
 
 private:
-    FrameNetworkingContextEfl(WebCore::Frame* frame)
-        : WebCore::FrameNetworkingContext(frame)
-    {
-    }
+    FrameNetworkingContextEfl(Frame*, Evas_Object*);
+
+    Evas_Object* m_ewkFrame;
 };
 
 }

Modified: trunk/Source/WebKit/efl/ewk/ewk_cookies.h (107853 => 107854)


--- trunk/Source/WebKit/efl/ewk/ewk_cookies.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/ewk/ewk_cookies.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -21,6 +21,12 @@
 /**
  * @file    ewk_cookies.h
  * @brief   The Ewk cookies API.
+ *
+ * @note If the libsoup network backend is being used the functions here will
+ * only work with the @b default SoupSession, which can be retrieved with
+ * ewk_network_defaul_soup_session_get(). If a different SoupSession is used
+ * and associated with a view with ewk_view_soup_session_set(), all cookie
+ * management will have to be done manually.
  */
 
 #ifndef ewk_cookies_h

Modified: trunk/Source/WebKit/efl/ewk/ewk_network.h (107853 => 107854)


--- trunk/Source/WebKit/efl/ewk/ewk_network.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/ewk/ewk_network.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -36,6 +36,11 @@
  * Sets the given proxy URI to network backend.
  *
  * @param proxy URI to set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI void             ewk_network_proxy_uri_set(const char *proxy);
 
@@ -45,6 +50,11 @@
  * The returned string should be freed by eina_stringshare_del() after use.
  *
  * @return current proxy URI or @c 0 if it's not set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI const char      *ewk_network_proxy_uri_get(void);
 
@@ -61,6 +71,11 @@
  * By default, HTTPS connections are performed regardless of the validity of the certificate provided.
  *
  * @sa ewk_network_tls_ca_certificates_path_set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI Eina_Bool        ewk_network_tls_certificate_check_get(void);
 
@@ -72,6 +87,11 @@
  * @param enable Whether to check the provided certificates or not.
  *
  * @sa ewk_network_tls_ca_certificates_path_set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI void             ewk_network_tls_certificate_check_set(Eina_Bool enable);
 
@@ -88,6 +108,11 @@
  * By default, the path is not set, so all certificates are considered as not signed by a trusted root CA.
  *
  * @sa ewk_network_tls_certificate_check_set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI const char      *ewk_network_tls_ca_certificates_path_get(void);
 
@@ -106,6 +131,11 @@
  * @param path The path to the certificate bundle.
  *
  * @sa ewk_network_tls_certificate_check_set
+ *
+ * @note If the libsoup backend is being used, this function has effect on
+ * the @b default SoupSession, returned by ewk_network_default_soup_session_get().
+ * If a different SoupSession is used and passed to ewk_view_soup_session_set(),
+ * this function will not have any effect on it.
  */
 EAPI void             ewk_network_tls_ca_certificates_path_set(const char *path);
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (107853 => 107854)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -50,6 +50,7 @@
 #include "ProgressTracker.h"
 #include "RefPtrCairo.h"
 #include "RenderTheme.h"
+#include "ResourceHandle.h"
 #include "Settings.h"
 #include "c_instance.h"
 #include "ewk_logging.h"
@@ -59,6 +60,7 @@
 #include <Evas.h>
 #include <eina_safety_checks.h>
 #include <inttypes.h>
+#include <libsoup/soup-session.h>
 #include <limits>
 #include <math.h>
 #include <sys/time.h>
@@ -211,6 +213,7 @@
         } center;
         Ecore_Animator* animator;
     } animatedZoom;
+    SoupSession* soupSession;
 };
 
 #ifndef EWK_TYPE_CHECK
@@ -714,6 +717,8 @@
         goto error_history;
     }
 
+    priv->soupSession = WebCore::ResourceHandle::defaultSession();
+
     return priv;
 
 error_history:
@@ -3913,6 +3918,25 @@
 #endif
 }
 
+SoupSession* ewk_view_soup_session_get(const Evas_Object* ewkView)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+    return priv->soupSession;
+}
+
+void ewk_view_soup_session_set(Evas_Object* ewkView, SoupSession* session)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+    if (!SOUP_IS_SESSION_ASYNC(session)) {
+        ERR("WebKit requires an SoupSessionAsync to work properly, but "
+            "a SoupSessionSync was provided.");
+        return;
+    }
+    priv->soupSession = session;
+}
+
 namespace EWKPrivate {
 
 WebCore::Page *corePage(const Evas_Object *ewkView)

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (107853 => 107854)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -95,6 +95,7 @@
 
 #include <Evas.h>
 #include <cairo.h>
+#include <libsoup/soup-session.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -2335,6 +2336,34 @@
  */
 EAPI Eina_Bool ewk_view_mixed_content_run_get(const Evas_Object *o);
 
+/**
+ * Returns the SoupSession associated with this view.
+ *
+ * By default, all views share the same, default soup session also available
+ * by calling ewk_network_default_soup_session_get.
+ *
+ * @param o The view to query.
+ *
+ * @sa ewk_view_soup_session_set, ewk_network_default_soup_session_get
+ */
+EAPI SoupSession* ewk_view_soup_session_get(const Evas_Object *o);
+
+/**
+ * Associates a new SoupSession with this view.
+ *
+ * Only sessions of type SoupSessionAsync are supported.
+ *
+ * @note Changing the SoupSession should not be needed in most cases. If
+ *       a different SoupSession is used, the cookie management and some
+ *       network functions in ewk will not have any effect on it.
+ *
+ * @param o The view to change.
+ * @param session The new SoupSession.
+ *
+ * @sa ewk_view_soup_session_get, ewk_network_default_soup_session_get
+ */
+EAPI void ewk_view_soup_session_set(Evas_Object *o, SoupSession *session);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit/gtk/ChangeLog (107853 => 107854)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-02-16 00:27:45 UTC (rev 107854)
@@ -1,3 +1,19 @@
+2012-01-31  Raphael Kubo da Costa  <[email protected]>
+
+        [soup] Add support for multiple SoupSessions.
+        https://bugs.webkit.org/show_bug.cgi?id=77341
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Adapt to the changes to FrameNetworkingContext in WebCore.
+
+        * GNUmakefile.am:
+        * WebCoreSupport/FrameNetworkingContextGtk.cpp: Copied from Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h.
+        (WebKit):
+        (WebKit::FrameNetworkingContextGtk::soupSession): Always return ResourceHandle::defaultSession().
+        * WebCoreSupport/FrameNetworkingContextGtk.h:
+        (FrameNetworkingContextGtk):
+
 2012-02-15  Sadrul Habib Chowdhury  <[email protected]>
 
         Notify ChromeClient when touch-event handlers are installed/removed.

Modified: trunk/Source/WebKit/gtk/GNUmakefile.am (107853 => 107854)


--- trunk/Source/WebKit/gtk/GNUmakefile.am	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/gtk/GNUmakefile.am	2012-02-16 00:27:45 UTC (rev 107854)
@@ -204,6 +204,7 @@
 	Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
 	Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
 	Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
+	Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.cpp \
 	Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h \
 	Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp \
 	Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.h \

Copied: trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.cpp (from rev 107852, trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h) (0 => 107854)


--- trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.cpp	                        (rev 0)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.cpp	2012-02-16 00:27:45 UTC (rev 107854)
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2012 ProFUSION embedded systems
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "FrameNetworkingContextGtk.h"
+
+#include "ResourceHandle.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+SoupSession* FrameNetworkingContextGtk::soupSession() const
+{
+    return ResourceHandle::defaultSession();
+}
+
+}

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h (107853 => 107854)


--- trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h	2012-02-16 00:08:32 UTC (rev 107853)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/FrameNetworkingContextGtk.h	2012-02-16 00:27:45 UTC (rev 107854)
@@ -32,6 +32,7 @@
     }
 
     WebCore::Frame* coreFrame() const { return frame(); }
+    virtual SoupSession* soupSession() const;
 
 private:
     FrameNetworkingContextGtk(WebCore::Frame* frame)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to