summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/WebProcessProxy.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/WebProcessProxy.h')
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.h184
1 files changed, 113 insertions, 71 deletions
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h
index a6d872241..e31894e90 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.h
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,69 +23,78 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebProcessProxy_h
-#define WebProcessProxy_h
+#pragma once
-#include "APISession.h"
+#include "APIUserInitiatedAction.h"
#include "ChildProcessProxy.h"
#include "MessageReceiverMap.h"
-#include "PlatformProcessIdentifier.h"
#include "PluginInfoStore.h"
#include "ProcessLauncher.h"
+#include "ProcessThrottlerClient.h"
#include "ResponsivenessTimer.h"
#include "WebConnectionToWebProcess.h"
#include "WebPageProxy.h"
#include "WebProcessProxyMessages.h"
#include <WebCore/LinkHash.h>
+#include <memory>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#if ENABLE(CUSTOM_PROTOCOLS)
-#include "CustomProtocolManagerProxy.h"
+#if PLATFORM(IOS)
+#include "ProcessThrottler.h"
#endif
namespace WebCore {
+class ResourceRequest;
class URL;
struct PluginInfo;
};
namespace WebKit {
-class DownloadProxyMap;
+class NetworkProcessProxy;
+class UnresponsiveWebProcessTerminator;
class WebBackForwardListItem;
-class WebContext;
class WebPageGroup;
+class WebProcessPool;
+enum class WebsiteDataType;
struct WebNavigationDataStore;
+struct WebsiteData;
-class WebProcessProxy : public ChildProcessProxy, ResponsivenessTimer::Client {
+class WebProcessProxy : public ChildProcessProxy, ResponsivenessTimer::Client, private ProcessThrottlerClient {
public:
typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem>> WebBackForwardListItemMap;
typedef HashMap<uint64_t, RefPtr<WebFrameProxy>> WebFrameProxyMap;
typedef HashMap<uint64_t, WebPageProxy*> WebPageProxyMap;
+ typedef HashMap<uint64_t, RefPtr<API::UserInitiatedAction>> UserInitiatedActionMap;
- static PassRefPtr<WebProcessProxy> create(WebContext&);
+ static Ref<WebProcessProxy> create(WebProcessPool&);
~WebProcessProxy();
- static WebProcessProxy* fromConnection(IPC::Connection* connection)
- {
- return static_cast<WebProcessProxy*>(ChildProcessProxy::fromConnection(connection));
- }
-
WebConnection* webConnection() const { return m_webConnection.get(); }
- WebContext& context() { return m_context.get(); }
+ WebProcessPool& processPool() { return m_processPool; }
static WebPageProxy* webPage(uint64_t pageID);
- PassRefPtr<WebPageProxy> createWebPage(PageClient&, const WebPageConfiguration&);
+ Ref<WebPageProxy> createWebPage(PageClient&, Ref<API::PageConfiguration>&&);
void addExistingWebPage(WebPageProxy*, uint64_t pageID);
void removeWebPage(uint64_t pageID);
- Vector<WebPageProxy*> pages() const;
+
+ WTF::IteratorRange<WebPageProxyMap::const_iterator::Values> pages() const { return m_pageMap.values(); }
+ unsigned pageCount() const { return m_pageMap.size(); }
+ unsigned visiblePageCount() const { return m_visiblePageCounter.value(); }
+
+ void addVisitedLinkStore(VisitedLinkStore&);
+ void addWebUserContentControllerProxy(WebUserContentControllerProxy&);
+ void didDestroyVisitedLinkStore(VisitedLinkStore&);
+ void didDestroyWebUserContentControllerProxy(WebUserContentControllerProxy&);
WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const;
+ RefPtr<API::UserInitiatedAction> userInitiatedActivity(uint64_t);
- ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; }
+ ResponsivenessTimer& responsivenessTimer() { return m_responsivenessTimer; }
WebFrameProxy* webFrame(uint64_t) const;
bool canCreateFrame(uint64_t frameID) const;
@@ -93,9 +102,12 @@ public:
void disconnectFramesFromPage(WebPageProxy*); // Including main frame.
size_t frameCountInPage(WebPageProxy*) const; // Including main frame.
+ VisibleWebPageToken visiblePageToken() const;
+
void updateTextCheckerState();
void registerNewWebBackForwardListItem(WebBackForwardListItem*);
+ void removeBackForwardItem(uint64_t);
void willAcquireUniversalFileReadSandboxExtension() { m_mayHaveUniversalFileReadSandboxExtension = true; }
void assumeReadAccessToBaseURL(const String&);
@@ -106,45 +118,59 @@ public:
static bool fullKeyboardAccessEnabled();
- DownloadProxy* createDownloadProxy();
-
- void pageSuppressibilityChanged(WebPageProxy*);
- void pagePreferencesChanged(WebPageProxy*);
-
void didSaveToPageCache();
void releasePageCache();
-#if PLATFORM(MAC)
- bool allPagesAreProcessSuppressible() const;
- void updateProcessSuppressionState();
-#endif
+ void fetchWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, Function<void(WebsiteData)> completionHandler);
+ void deleteWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()> completionHandler);
+ void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()> completionHandler);
+ static void deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>& topPrivatelyOwnedDomains, bool shouldNotifyPages, std::function<void()> completionHandler);
void enableSuddenTermination();
void disableSuddenTermination();
+ bool isSuddenTerminationEnabled() { return !m_numberOfTimesSuddenTerminationWasDisabled; }
void requestTermination();
- RefPtr<API::Object> apiObjectByConvertingToHandles(API::Object*);
+ RefPtr<API::Object> transformHandlesToObjects(API::Object*);
+ static RefPtr<API::Object> transformObjectsToHandles(API::Object*);
+
+#if PLATFORM(COCOA)
+ RefPtr<ObjCObjectGraph> transformHandlesToObjects(ObjCObjectGraph&);
+ static RefPtr<ObjCObjectGraph> transformObjectsToHandles(ObjCObjectGraph&);
+#endif
void windowServerConnectionStateChanged();
+ void processReadyToSuspend();
+ void didCancelProcessSuspension();
+
+ void setIsHoldingLockedFiles(bool);
+
+ ProcessThrottler& throttler() { return m_throttler; }
+
+ void reinstateNetworkProcessAssertionState(NetworkProcessProxy&);
+
+ void isResponsive(std::function<void(bool isWebProcessResponsive)>);
+ void didReceiveMainThreadPing();
+
private:
- explicit WebProcessProxy(WebContext&);
+ explicit WebProcessProxy(WebProcessPool&);
// From ChildProcessProxy
- virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
- void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&);
- virtual void connectionWillOpen(IPC::Connection*) override;
- virtual void connectionWillClose(IPC::Connection*) override;
+ void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
+ void connectionWillOpen(IPC::Connection&) override;
+ void processWillShutDown(IPC::Connection&) override;
// Called when the web process has crashed or we know that it will terminate soon.
// Will potentially cause the WebProcessProxy object to be freed.
- void disconnect();
+ void shutDown();
// IPC message handlers.
- void addBackForwardItem(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title, const IPC::DataReference& backForwardData);
+ void addBackForwardItem(uint64_t itemID, uint64_t pageID, const PageState&);
void didDestroyFrame(uint64_t);
-
+ void didDestroyUserGestureToken(uint64_t);
+
void shouldTerminate(bool& shouldTerminate);
// Plugins
@@ -152,46 +178,57 @@ private:
void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins);
#endif // ENABLE(NETSCAPE_PLUGIN_API)
#if ENABLE(NETSCAPE_PLUGIN_API)
- void getPluginProcessConnection(uint64_t pluginProcessToken, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
-#endif
-#if ENABLE(NETWORK_PROCESS)
- void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>);
+ void getPluginProcessConnection(uint64_t pluginProcessToken, Ref<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>&&);
#endif
+ void getNetworkProcessConnection(Ref<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>&&);
#if ENABLE(DATABASE_PROCESS)
- void getDatabaseProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetDatabaseProcessConnection::DelayedReply>);
+ void getDatabaseProcessConnection(Ref<Messages::WebProcessProxy::GetDatabaseProcessConnection::DelayedReply>&&);
#endif
+ void retainIconForPageURL(const String& pageURL);
+ void releaseIconForPageURL(const String& pageURL);
+ void releaseRemainingIconsForPageURLs();
+
+ bool platformIsBeingDebugged() const;
+
+ static const HashSet<String>& platformPathsWithAssumedReadAccess();
+
+ void updateBackgroundResponsivenessTimer();
+
// IPC::Connection::Client
friend class WebConnectionToWebProcess;
- virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
- virtual void didReceiveSyncMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
- virtual void didClose(IPC::Connection*) override;
- virtual void didReceiveInvalidMessage(IPC::Connection*, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+ void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
+ void didClose(IPC::Connection&) override;
+ void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
// ResponsivenessTimer::Client
- void didBecomeUnresponsive(ResponsivenessTimer*) override;
- void interactionOccurredWhileUnresponsive(ResponsivenessTimer*) override;
- void didBecomeResponsive(ResponsivenessTimer*) override;
+ void didBecomeUnresponsive() override;
+ void didBecomeResponsive() override;
+ void willChangeIsResponsive() override;
+ void didChangeIsResponsive() override;
+ bool mayBecomeUnresponsive() override;
+
+ // ProcessThrottlerClient
+ void sendProcessWillSuspendImminently() override;
+ void sendPrepareToSuspend() override;
+ void sendCancelPrepareToSuspend() override;
+ void sendProcessDidResume() override;
+ void didSetAssertionState(AssertionState) override;
// ProcessLauncher::Client
- virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
-
- // History client
- void didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore&, uint64_t frameID);
- void didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
- void didPerformServerRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
- void didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID);
+ void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
// Implemented in generated WebProcessProxyMessageReceiver.cpp
- void didReceiveWebProcessProxyMessage(IPC::Connection*, IPC::MessageDecoder&);
- void didReceiveSyncWebProcessProxyMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
+ void didReceiveWebProcessProxyMessage(IPC::Connection&, IPC::Decoder&);
+ void didReceiveSyncWebProcessProxyMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
bool canTerminateChildProcess();
ResponsivenessTimer m_responsivenessTimer;
RefPtr<WebConnectionToWebProcess> m_webConnection;
- Ref<WebContext> m_context;
+ Ref<WebProcessPool> m_processPool;
bool m_mayHaveUniversalFileReadSandboxExtension; // True if a read extension for "/" was ever granted - we don't track whether WebProcess still has it.
HashSet<String> m_localPathsWithAssumedReadAccess;
@@ -199,21 +236,26 @@ private:
WebPageProxyMap m_pageMap;
WebFrameProxyMap m_frameMap;
WebBackForwardListItemMap m_backForwardListItemMap;
+ UserInitiatedActionMap m_userInitiatedActionMap;
- OwnPtr<DownloadProxyMap> m_downloadProxyMap;
+ HashSet<VisitedLinkStore*> m_visitedLinkStores;
+ HashSet<WebUserContentControllerProxy*> m_webUserContentControllerProxies;
-#if ENABLE(CUSTOM_PROTOCOLS)
- CustomProtocolManagerProxy m_customProtocolManagerProxy;
+ int m_numberOfTimesSuddenTerminationWasDisabled;
+ ProcessThrottler m_throttler;
+ ProcessThrottler::BackgroundActivityToken m_tokenForHoldingLockedFiles;
+#if PLATFORM(IOS)
+ ProcessThrottler::ForegroundActivityToken m_foregroundTokenForNetworkProcess;
+ ProcessThrottler::BackgroundActivityToken m_backgroundTokenForNetworkProcess;
#endif
-#if PLATFORM(MAC)
- HashSet<uint64_t> m_processSuppressiblePages;
- bool m_processSuppressionEnabled;
-#endif
+ HashMap<String, uint64_t> m_pageURLRetainCountMap;
- int m_numberOfTimesSuddenTerminationWasDisabled;
+ enum class NoOrMaybe { No, Maybe } m_isResponsive;
+ Vector<std::function<void(bool webProcessIsResponsive)>> m_isResponsiveCallbacks;
+
+ VisibleWebPageCounter m_visiblePageCounter;
+ std::unique_ptr<UnresponsiveWebProcessTerminator> m_backgroundResponsivenessTimer;
};
-
-} // namespace WebKit
-#endif // WebProcessProxy_h
+} // namespace WebKit