summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/WebContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/WebContext.h')
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h44
1 files changed, 37 insertions, 7 deletions
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index 2de4a71c6..11a338d3c 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,11 +28,13 @@
#include "APIObject.h"
#include "GenericCallback.h"
+#include "MessageReceiver.h"
+#include "MessageReceiverMap.h"
#include "PluginInfoStore.h"
#include "ProcessModel.h"
#include "VisitedLinkProvider.h"
-#include "WebContextInjectedBundleClient.h"
#include "WebContextConnectionClient.h"
+#include "WebContextInjectedBundleClient.h"
#include "WebDownloadClient.h"
#include "WebHistoryClient.h"
#include "WebProcessProxy.h"
@@ -44,6 +46,10 @@
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
+#if ENABLE(NETWORK_PROCESS)
+#include "NetworkProcessProxy.h"
+#endif
+
namespace WebKit {
class DownloadProxy;
@@ -75,7 +81,7 @@ struct WebProcessCreationParameters;
typedef GenericCallback<WKDictionaryRef> DictionaryCallback;
-class WebContext : public APIObject {
+class WebContext : public APIObject, private CoreIPC::MessageReceiver {
public:
static const Type APIType = TypeContext;
@@ -84,6 +90,10 @@ public:
static const Vector<WebContext*>& allContexts();
+ void addMessageReceiver(CoreIPC::MessageClass, CoreIPC::MessageReceiver*);
+ bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool dispatchSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
+
void initializeInjectedBundleClient(const WKContextInjectedBundleClient*);
void initializeConnectionClient(const WKContextConnectionClient*);
void initializeHistoryClient(const WKContextHistoryClient*);
@@ -140,8 +150,9 @@ public:
void addVisitedLink(const String&);
void addVisitedLinkHash(WebCore::LinkHash);
- void didReceiveMessage(WebProcessProxy*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void didReceiveSyncMessage(WebProcessProxy*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
+ // MessageReceiver.
+ virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+ virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE;
void setCacheModel(CacheModel);
CacheModel cacheModel() const { return m_cacheModel; }
@@ -230,6 +241,8 @@ public:
void textCheckerStateChanged();
+ void setUsesNetworkProcess(bool);
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
@@ -237,7 +250,11 @@ private:
void platformInitializeWebProcess(WebProcessCreationParameters&);
void platformInvalidateContext();
-
+
+#if ENABLE(NETWORK_PROCESS)
+ void ensureNetworkProcess();
+#endif
+
#if PLATFORM(MAC)
void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes);
void getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames);
@@ -307,6 +324,10 @@ private:
bool m_alwaysUsesComplexTextCodePath;
bool m_shouldUseFontSmoothing;
+ // Messages that were posted before any pages were created.
+ // The client should use initialization messages instead, so that a restarted process would get the same state.
+ Vector<pair<String, RefPtr<APIObject> > > m_messagesToInjectedBundlePostedToEmptyContext;
+
CacheModel m_cacheModel;
WebDownloadClient m_downloadClient;
@@ -354,8 +375,15 @@ private:
String m_overrideLocalStorageDirectory;
bool m_processTerminationEnabled;
+
+#if ENABLE(NETWORK_PROCESS)
+ RefPtr<NetworkProcessProxy> m_networkProcess;
+ bool m_usesNetworkProcess;
+#endif
HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks;
+
+ CoreIPC::MessageReceiverMap m_messageReceiverMap;
};
template<typename U> inline void WebContext::sendToAllProcesses(const U& message)
@@ -370,7 +398,9 @@ template<typename U> inline void WebContext::sendToAllProcesses(const U& message
template<typename U> void WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message)
{
- relaunchProcessIfNecessary();
+// FIXME (Multi-WebProcess): WebContext doesn't track processes that have exited, so it cannot relaunch these. Perhaps this functionality won't be needed in this mode.
+ if (m_processModel == ProcessModelSharedSecondaryProcess)
+ relaunchProcessIfNecessary();
sendToAllProcesses(message);
}