[PSON] Avoid tearing down the drawing area when suspending a WebPage due to process...
[WebKit-https.git] / Source / WebKit / UIProcess / SuspendedPageProxy.h
index cd9cbc0..7fa0c3e 100644 (file)
 
 #include "Connection.h"
 #include "WebBackForwardListItem.h"
+#include <WebCore/SecurityOriginData.h>
 #include <wtf/RefCounted.h>
+#include <wtf/WeakPtr.h>
 
 namespace WebKit {
 
 class WebPageProxy;
 class WebProcessProxy;
 
-class SuspendedPageProxy : public RefCounted<SuspendedPageProxy> {
+class SuspendedPageProxy final: public IPC::MessageReceiver, public CanMakeWeakPtr<SuspendedPageProxy> {
 public:
-    static Ref<SuspendedPageProxy> create(WebPageProxy& page, WebProcessProxy& process, WebBackForwardListItem& item)
-    {
-        return adoptRef(*new SuspendedPageProxy(page, process, item));
-    }
-
-    virtual ~SuspendedPageProxy();
-
-    void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
+    SuspendedPageProxy(WebPageProxy&, Ref<WebProcessProxy>&&, WebBackForwardListItem&, uint64_t mainFrameID);
+    ~SuspendedPageProxy();
 
     WebPageProxy& page() const { return m_page; }
-    WebProcessProxy* process() const { return m_process; }
-    WebBackForwardListItem& item() const { return m_backForwardListItem; }
+    WebProcessProxy& process() { return m_process.get(); }
+    uint64_t mainFrameID() const { return m_mainFrameID; }
+    const WebCore::SecurityOriginData& origin() const { return m_origin; }
 
-    bool finishedSuspending() const { return m_finishedSuspending; }
-
-    void webProcessDidClose(WebProcessProxy&);
+    void unsuspend();
 
 #if !LOG_DISABLED
     const char* loggingString() const;
 #endif
 
 private:
-    SuspendedPageProxy(WebPageProxy&, WebProcessProxy&, WebBackForwardListItem&);
-
     void didFinishLoad();
 
+    // IPC::MessageReceiver
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
+    void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
+
     WebPageProxy& m_page;
-    WebProcessProxy* m_process;
-    Ref<WebBackForwardListItem> m_backForwardListItem;
+    Ref<WebProcessProxy> m_process;
+    uint64_t m_mainFrameID;
+    WebCore::SecurityOriginData m_origin;
+
+    bool m_isSuspended { true };
 
+#if !LOG_DISABLED
     bool m_finishedSuspending { false };
+#endif
 };
 
 } // namespace WebKit