Diff
Modified: trunk/Source/WebKit2/ChangeLog (138432 => 138433)
--- trunk/Source/WebKit2/ChangeLog 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-24 05:45:05 UTC (rev 138433)
@@ -1,5 +1,48 @@
2012-12-23 Sam Weinig <[email protected]>
+ Switch WebCookieManager and AuthenticationManager to use the ChildProcess rather than holding on to a Connection
+ https://bugs.webkit.org/show_bug.cgi?id=105703
+
+ Reviewed by Dan Bernstein.
+
+ Also switches WebCookieManager over to be a MessageReceiver while we are at it.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::NetworkProcess):
+ (WebKit::NetworkProcess::initialize):
+ (WebKit::NetworkProcess::didReceiveMessage):
+ * NetworkProcess/NetworkProcess.h:
+ (WebKit):
+ * WebProcess/Authentication/AuthenticationManager.cpp:
+ (WebKit::AuthenticationManager::AuthenticationManager):
+ (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+ * WebProcess/Authentication/AuthenticationManager.h:
+ (AuthenticationManager):
+ * WebProcess/Cookies/WebCookieManager.cpp:
+ (WebKit):
+ (WebKit::WebCookieManager::WebCookieManager):
+ (WebKit::WebCookieManager::didReceiveMessage):
+ (WebKit::WebCookieManager::getHostnamesWithCookies):
+ (WebKit::WebCookieManager::cookiesDidChange):
+ (WebKit::WebCookieManager::dispatchCookiesDidChange):
+ (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
+ * WebProcess/Cookies/WebCookieManager.h:
+ (WebKit):
+ (WebCookieManager):
+ * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
+ (WebKit::WebCookieManager::setCookiePersistentStorage):
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::setAlwaysAcceptCookies):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::WebProcess):
+ (WebKit::WebProcess::initialize):
+ (WebKit::WebProcess::didReceiveMessage):
+ * WebProcess/WebProcess.h:
+ (WebProcess):
+ (WebKit::WebProcess::cookieManager):
+
+2012-12-23 Sam Weinig <[email protected]>
+
Try to fix the Qt build.
* WebProcess/WebCoreSupport/WebDatabaseManager.h:
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (138432 => 138433)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -56,6 +56,7 @@
: m_hasSetCacheModel(false)
, m_cacheModel(CacheModelDocumentViewer)
, m_downloadsAuthenticationManager(this)
+ , m_cookieManager(new WebCookieManager(this))
{
#if ENABLE(CUSTOM_PROTOCOLS)
CustomProtocolManager::shared().initialize(this);
@@ -79,9 +80,6 @@
m_uiConnection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop);
m_uiConnection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
m_uiConnection->open();
-
- m_downloadsAuthenticationManager.setConnection(m_uiConnection.get());
- WebCookieManager::shared().setConnection(m_uiConnection.get());
}
void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess* connection)
@@ -103,11 +101,6 @@
if (m_messageReceiverMap.dispatchMessage(connection, messageID, decoder))
return;
- if (messageID.is<CoreIPC::MessageClassWebCookieManager>()) {
- WebCookieManager::shared().didReceiveMessage(connection, messageID, decoder);
- return;
- }
-
didReceiveNetworkProcessMessage(connection, messageID, decoder);
}
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (138432 => 138433)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2012-12-24 05:45:05 UTC (rev 138433)
@@ -43,6 +43,7 @@
namespace WebKit {
class NetworkConnectionToWebProcess;
+class WebCookieManager;
struct NetworkProcessCreationParameters;
class NetworkProcess : public ChildProcess, DownloadManager::Client {
@@ -113,6 +114,8 @@
CacheModel m_cacheModel;
AuthenticationManager m_downloadsAuthenticationManager;
+
+ WebCookieManager* m_cookieManager;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -30,7 +30,6 @@
#include "ChildProcess.h"
#include "Download.h"
#include "DownloadProxyMessages.h"
-#include "MessageID.h"
#include "WebCoreArgumentCoders.h"
#include "WebFrame.h"
#include "WebPage.h"
@@ -48,17 +47,12 @@
return uniqueAuthenticationChallengeID++;
}
-AuthenticationManager::AuthenticationManager(ChildProcess* childProcess)
+AuthenticationManager::AuthenticationManager(ChildProcess* process)
+ : m_process(process)
{
- childProcess->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
+ m_process->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
}
-void AuthenticationManager::setConnection(CoreIPC::Connection* connection)
-{
- ASSERT(!m_connection);
- m_connection = connection;
-}
-
void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
{
didReceiveAuthenticationManagerMessage(connection, messageID, decoder);
@@ -72,7 +66,7 @@
uint64_t challengeID = generateAuthenticationChallengeID();
m_challenges.set(challengeID, authenticationChallenge);
- m_connection->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
+ m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
}
void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge)
Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h 2012-12-24 05:45:05 UTC (rev 138433)
@@ -29,13 +29,6 @@
#include "MessageReceiver.h"
#include <wtf/HashMap.h>
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-class MessageID;
-class MessageReceiverMap;
-}
-
namespace WebCore {
class AuthenticationChallenge;
class Credential;
@@ -50,12 +43,9 @@
class AuthenticationManager : private CoreIPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(AuthenticationManager);
-
public:
explicit AuthenticationManager(ChildProcess*);
- void setConnection(CoreIPC::Connection*);
-
void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
void didReceiveAuthenticationChallenge(Download*, const WebCore::AuthenticationChallenge&);
@@ -70,7 +60,7 @@
bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
- RefPtr<CoreIPC::Connection> m_connection;
+ ChildProcess* m_process;
typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
AuthenticationChallengeMap m_challenges;
Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -26,50 +26,46 @@
#include "config.h"
#include "WebCookieManager.h"
-#include "MessageID.h"
+#include "ChildProcess.h"
+#include "WebCookieManagerMessages.h"
#include "WebCookieManagerProxyMessages.h"
-#include "WebProcess.h"
+#include "WebCoreArgumentCoders.h"
#include <WebCore/CookieStorage.h>
#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PlatformCookieJar.h>
#include <wtf/MainThread.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
using namespace WebCore;
namespace WebKit {
-WebCookieManager& WebCookieManager::shared()
-{
- DEFINE_STATIC_LOCAL(WebCookieManager, shared, ());
- return shared;
-}
+static WebCookieManager* sharedCookieManager;
-WebCookieManager::WebCookieManager()
+WebCookieManager::WebCookieManager(ChildProcess* process)
+ : m_process(process)
{
-}
+ m_process->addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), this);
-void WebCookieManager::setConnection(CoreIPC::Connection* connection)
-{
- ASSERT(!m_connection);
- m_connection = connection;
+ ASSERT(!sharedCookieManager);
+ sharedCookieManager = this;
}
void WebCookieManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
{
- ASSERT(connection == m_connection.get());
didReceiveWebCookieManagerMessage(connection, messageID, decoder);
}
void WebCookieManager::getHostnamesWithCookies(uint64_t callbackID)
{
HashSet<String> hostnames;
-
WebCore::getHostnamesWithCookies(NetworkStorageSession::defaultStorageSession(), hostnames);
Vector<String> hostnameList;
copyToVector(hostnames, hostnameList);
- m_connection->send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
+ m_process->send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
}
void WebCookieManager::deleteCookiesForHostname(const String& hostname)
@@ -94,13 +90,13 @@
void WebCookieManager::cookiesDidChange()
{
- WebCookieManager::shared().dispatchCookiesDidChange();
+ sharedCookieManager->dispatchCookiesDidChange();
}
void WebCookieManager::dispatchCookiesDidChange()
{
ASSERT(isMainThread());
- m_connection->send(Messages::WebCookieManagerProxy::CookiesDidChange(), 0);
+ m_process->send(Messages::WebCookieManagerProxy::CookiesDidChange(), 0);
}
void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
@@ -110,7 +106,7 @@
void WebCookieManager::getHTTPCookieAcceptPolicy(uint64_t callbackID)
{
- m_connection->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
+ m_process->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h 2012-12-24 05:45:05 UTC (rev 138433)
@@ -27,38 +27,29 @@
#define WebCookieManager_h
#include "HTTPCookieAcceptPolicy.h"
+#include "MessageReceiver.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
#if USE(SOUP)
#include "SoupCookiePersistentStorageType.h"
#endif
-namespace CoreIPC {
- class Connection;
- class MessageDecoder;
- class MessageID;
-}
-
namespace WebKit {
-class WebCookieManager {
+class ChildProcess;
+
+class WebCookieManager : private CoreIPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebCookieManager);
public:
- static WebCookieManager& shared();
- void setConnection(CoreIPC::Connection*);
+ WebCookieManager(ChildProcess*);
- void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
-
#if USE(SOUP)
void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
#endif
-private:
- WebCookieManager();
-
+private:
void getHostnamesWithCookies(uint64_t callbackID);
void deleteCookiesForHostname(const String&);
void deleteAllCookies();
@@ -73,9 +64,10 @@
static void cookiesDidChange();
void dispatchCookiesDidChange();
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
void didReceiveWebCookieManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
- RefPtr<CoreIPC::Connection> m_connection;
+ ChildProcess* m_process;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -26,8 +26,8 @@
#include "config.h"
#include "WebCookieManager.h"
+#include "ChildProcess.h"
#include "WebKitSoupCookieJarSqlite.h"
-#include "WebProcess.h"
#include <WebCore/CookieJarSoup.h>
#include <WebCore/ResourceHandle.h>
#include <libsoup/soup.h>
@@ -84,7 +84,7 @@
void WebCookieManager::setCookiePersistentStorage(const String& storagePath, uint32_t storageType)
{
- WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
+ ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);
GRefPtr<SoupCookieJar> jar;
switch (storageType) {
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -139,7 +139,7 @@
void InjectedBundle::setAlwaysAcceptCookies(bool accept)
{
- WebCookieManager::shared().setHTTPCookieAcceptPolicy(accept ? HTTPCookieAcceptPolicyAlways : HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain);
+ WebProcess::shared().cookieManager().setHTTPCookieAcceptPolicy(accept ? HTTPCookieAcceptPolicyAlways : HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain);
}
void InjectedBundle::removeAllVisitedLinks()
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -33,7 +33,6 @@
#include "SandboxExtension.h"
#include "StatisticsData.h"
#include "WebContextMessages.h"
-#include "WebCookieManager.h"
#include "WebCoreArgumentCoders.h"
#include "WebFrame.h"
#include "WebFrameNetworkingContext.h"
@@ -131,6 +130,7 @@
, m_geolocationManager(this)
, m_applicationCacheManager(this)
, m_resourceCacheManager(this)
+ , m_cookieManager(this)
#if ENABLE(SQL_DATABASE)
, m_databaseManager(this)
#endif
@@ -181,9 +181,6 @@
m_webConnection = WebConnectionToUIProcess::create(this);
m_runLoop = runLoop;
-
- m_authenticationManager.setConnection(m_connection.get());
- WebCookieManager::shared().setConnection(m_connection.get());
}
void WebProcess::didCreateDownload()
@@ -577,11 +574,6 @@
return;
}
- if (messageID.is<CoreIPC::MessageClassWebCookieManager>()) {
- WebCookieManager::shared().didReceiveMessage(connection, messageID, decoder);
- return;
- }
-
if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManager>()) {
WebKeyValueStorageManager::shared().didReceiveMessage(connection, messageID, decoder);
return;
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-24 05:45:05 UTC (rev 138433)
@@ -41,6 +41,7 @@
#include "VisitedLinkTable.h"
#include "WebApplicationCacheManager.h"
#include "WebConnectionToUIProcess.h"
+#include "WebCookieManager.h"
#include "WebGeolocationManager.h"
#include "WebIconDatabaseProxy.h"
#include "WebPageGroupProxy.h"
@@ -188,6 +189,9 @@
// Resource Cache
WebResourceCacheManager& resourceCacheManager() { return m_resourceCacheManager; }
+ // Cookies
+ WebCookieManager& cookieManager() { return m_cookieManager; }
+
#if ENABLE(SQL_DATABASE)
// Database
WebDatabaseManager& databaseManager() { return m_databaseManager; }
@@ -387,6 +391,7 @@
WebGeolocationManager m_geolocationManager;
WebApplicationCacheManager m_applicationCacheManager;
WebResourceCacheManager m_resourceCacheManager;
+ WebCookieManager m_cookieManager;
#if ENABLE(SQL_DATABASE)
WebDatabaseManager m_databaseManager;
Modified: trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -171,10 +171,10 @@
m_soupRequestManager.registerURIScheme(parameters.urlSchemesRegistered[i]);
if (!parameters.cookiePersistentStoragePath.isEmpty()) {
- WebCookieManager::shared().setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
+ cookieManager().setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
parameters.cookiePersistentStorageType);
}
- WebCookieManager::shared().setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
+ cookieManager().setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
setIgnoreTLSErrors(parameters.ignoreTLSErrors);
Modified: trunk/Source/WebKit2/WebProcess/win/WebProcessWin.cpp (138432 => 138433)
--- trunk/Source/WebKit2/WebProcess/win/WebProcessWin.cpp 2012-12-24 05:05:13 UTC (rev 138432)
+++ trunk/Source/WebKit2/WebProcess/win/WebProcessWin.cpp 2012-12-24 05:45:05 UTC (rev 138433)
@@ -141,7 +141,7 @@
ResourceHandle::setDefaultStorageSession(defaultStorageSession.get());
#endif
- WebCookieManager::shared().setHTTPCookieAcceptPolicy(parameters.initialHTTPCookieAcceptPolicy);
+ cookieManager().setHTTPCookieAcceptPolicy(parameters.initialHTTPCookieAcceptPolicy);
// By using the default storage session that came from the ui process, the web process
// automatically uses the same the URL Cache as ui process.