Diff
Modified: trunk/Source/WebKit2/ChangeLog (137861 => 137862)
--- trunk/Source/WebKit2/ChangeLog 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-17 01:51:18 UTC (rev 137862)
@@ -1,5 +1,43 @@
2012-12-16 Anders Carlsson <[email protected]>
+ Authentication manager cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=105144
+
+ Reviewed by Sam Weinig.
+
+ Some cleanup to make it possible to reuse the authentication manager from the network process.
+
+ * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
+ (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
+ (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy):
+ (WebKit::AuthenticationChallengeProxy::useCredential):
+ (WebKit::AuthenticationChallengeProxy::cancel):
+ * UIProcess/Authentication/AuthenticationChallengeProxy.h:
+ (WebKit::AuthenticationChallengeProxy::create):
+ (AuthenticationChallengeProxy):
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
+ * WebProcess/Authentication/AuthenticationManager.cpp:
+ (WebKit::AuthenticationManager::AuthenticationManager):
+ (WebKit::AuthenticationManager::setConnection):
+ (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+ (WebKit::AuthenticationManager::useCredentialForChallenge):
+ * WebProcess/Authentication/AuthenticationManager.h:
+ * WebProcess/Downloads/Download.cpp:
+ (WebKit::Download::didReceiveAuthenticationChallenge):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::WebProcess):
+ (WebKit::WebProcess::initialize):
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::authenticationManager):
+ (WebProcess):
+
+2012-12-16 Anders Carlsson <[email protected]>
+
Rudimentary support for main resource downloads
https://bugs.webkit.org/show_bug.cgi?id=105141
Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp (137861 => 137862)
--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -28,19 +28,19 @@
#include "AuthenticationDecisionListener.h"
#include "AuthenticationManagerMessages.h"
+#include "ChildProcessProxy.h"
#include "WebCertificateInfo.h"
#include "WebCoreArgumentCoders.h"
#include "WebCredential.h"
-#include "WebPageProxy.h"
#include "WebProcessProxy.h"
#include "WebProtectionSpace.h"
namespace WebKit {
-AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process)
+AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, CoreIPC::Connection* connection)
: m_coreAuthenticationChallenge(authenticationChallenge)
, m_challengeID(challengeID)
- , m_process(process)
+ , m_connection(connection)
{
ASSERT(m_challengeID);
m_listener = AuthenticationDecisionListener::create(this);
@@ -49,9 +49,9 @@
AuthenticationChallengeProxy::~AuthenticationChallengeProxy()
{
// If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,
- // we cancel it here so the WebProcess isn't waiting for an answer forever.
+ // we cancel it here so the process isn't waiting for an answer forever.
if (m_challengeID)
- m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
+ m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
if (m_listener)
m_listener->detachChallenge();
@@ -63,11 +63,11 @@
return;
if (!credential)
- m_process->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), 0);
+ m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), 0);
else {
WebCertificateInfo* certificateInfo = credential->certificateInfo();
PlatformCertificateInfo platformInfo = certificateInfo ? certificateInfo->platformCertificateInfo() : PlatformCertificateInfo();
- m_process->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core(), platformInfo), 0);
+ m_connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core(), platformInfo), 0);
}
m_challengeID = 0;
@@ -78,7 +78,7 @@
if (!m_challengeID)
return;
- m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
+ m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
m_challengeID = 0;
}
Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h (137861 => 137862)
--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h 2012-12-17 01:51:18 UTC (rev 137862)
@@ -39,17 +39,17 @@
namespace WebKit {
class AuthenticationDecisionListener;
+class ChildProcessProxy;
class WebCredential;
-class WebProcessProxy;
class WebProtectionSpace;
class AuthenticationChallengeProxy : public APIObject {
public:
static const Type APIType = TypeAuthenticationChallenge;
- static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process)
+ static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, CoreIPC::Connection* connection)
{
- return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, process));
+ return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, connection));
}
~AuthenticationChallengeProxy();
@@ -64,13 +64,13 @@
const WebCore::AuthenticationChallenge& core() { return m_coreAuthenticationChallenge; }
private:
- AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebProcessProxy*);
+ AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, CoreIPC::Connection*);
virtual Type type() const { return APIType; }
WebCore::AuthenticationChallenge m_coreAuthenticationChallenge;
uint64_t m_challengeID;
- RefPtr<WebProcessProxy> m_process;
+ RefPtr<CoreIPC::Connection> m_connection;
RefPtr<AuthenticationDecisionListener> m_listener;
mutable RefPtr<WebCredential> m_webCredential;
mutable RefPtr<WebProtectionSpace> m_webProtectionSpace;
Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp (137861 => 137862)
--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -124,7 +124,8 @@
// FIXME (Multi-WebProcess): <rdar://problem/12239483> Downloads shouldn't be handled in the web process.
// Once this is fixed, remove WebContext::deprecatedSharedProcess().
- RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess());
+
+ RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess()->connection());
m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext.get(), this, authenticationChallengeProxy.get());
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (137861 => 137862)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -3840,7 +3840,7 @@
WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process.get());
+ RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process->connection());
m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
}
Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -30,11 +30,11 @@
#include "Download.h"
#include "DownloadProxyMessages.h"
#include "MessageID.h"
+#include "MessageReceiverMap.h"
#include "WebCoreArgumentCoders.h"
#include "WebFrame.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/AuthenticationClient.h>
@@ -48,15 +48,15 @@
return uniqueAuthenticationChallengeID++;
}
-AuthenticationManager& AuthenticationManager::shared()
+AuthenticationManager::AuthenticationManager(CoreIPC::MessageReceiverMap& messageReceiverMap)
{
- static AuthenticationManager& manager = *new AuthenticationManager;
- return manager;
+ messageReceiverMap.addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
}
-AuthenticationManager::AuthenticationManager()
+void AuthenticationManager::setConnection(CoreIPC::Connection* connection)
{
- WebProcess::shared().addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
+ ASSERT(!m_connection);
+ m_connection = connection;
}
void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
@@ -72,7 +72,7 @@
uint64_t challengeID = generateAuthenticationChallengeID();
m_challenges.set(challengeID, authenticationChallenge);
- WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
+ m_connection->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
}
void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge)
@@ -104,7 +104,6 @@
// This authentication challenge comes from a download.
Download::receivedCredential(challenge, credential);
return;
-
}
coreClient->receivedCredential(challenge, credential);
Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h 2012-12-17 01:51:18 UTC (rev 137862)
@@ -30,9 +30,10 @@
#include <wtf/HashMap.h>
namespace CoreIPC {
- class ArgumentDecoder;
- class Connection;
- class MessageID;
+class ArgumentDecoder;
+class Connection;
+class MessageID;
+class MessageReceiverMap;
}
namespace WebCore {
@@ -50,8 +51,11 @@
WTF_MAKE_NONCOPYABLE(AuthenticationManager);
public:
- static AuthenticationManager& shared();
+ // FIXME: ChildProcess should just have a MessageReceiverMap, and this should take a ChildProcess.
+ explicit AuthenticationManager(CoreIPC::MessageReceiverMap&);
+ void setConnection(CoreIPC::Connection*);
+
void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
void didReceiveAuthenticationChallenge(Download*, const WebCore::AuthenticationChallenge&);
@@ -60,14 +64,15 @@
void cancelChallenge(uint64_t challengeID);
private:
- AuthenticationManager();
// CoreIPC::MessageReceiver
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
-
+
+ RefPtr<CoreIPC::Connection> m_connection;
+
typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
AuthenticationChallengeMap m_challenges;
};
Modified: trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -79,7 +79,7 @@
void Download::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge)
{
- AuthenticationManager::shared().didReceiveAuthenticationChallenge(this, authenticationChallenge);
+// AuthenticationManager::shared().didReceiveAuthenticationChallenge(this, authenticationChallenge);
}
void Download::didReceiveResponse(const ResourceResponse& response)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -211,7 +211,7 @@
if (!webPage)
return;
- AuthenticationManager::shared().didReceiveAuthenticationChallenge(m_frame, challenge);
+ WebProcess::shared().authenticationManager().didReceiveAuthenticationChallenge(m_frame, challenge);
}
void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long /*identifier*/, const AuthenticationChallenge&)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-17 01:51:18 UTC (rev 137862)
@@ -174,6 +174,7 @@
#if USE(SOUP)
, m_soupRequestManager(this)
#endif
+ , m_authenticationManager(m_messageReceiverMap)
{
#if USE(PLATFORM_STRATEGIES)
// Initialize our platform strategies.
@@ -201,6 +202,8 @@
m_runLoop = runLoop;
+ m_authenticationManager.setConnection(m_connection.get());
+
startRandomCrashThreadIfRequested();
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (137861 => 137862)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-17 01:26:44 UTC (rev 137861)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-17 01:51:18 UTC (rev 137862)
@@ -26,6 +26,7 @@
#ifndef WebProcess_h
#define WebProcess_h
+#include "AuthenticationManager.h"
#include "CacheModel.h"
#include "ChildProcess.h"
#include "DownloadManager.h"
@@ -217,6 +218,7 @@
void destroyPrivateBrowsingSession();
DownloadManager& downloadManager();
+ AuthenticationManager& authenticationManager() { return m_authenticationManager; }
private:
WebProcess();
@@ -393,6 +395,7 @@
WebSoupRequestManager m_soupRequestManager;
#endif
+ AuthenticationManager m_authenticationManager;
};
} // namespace WebKit