Every PageOverlayClientImpl leaks
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebPage / WebPageOverlay.h
index 576f5a9757f735f7bf8753dc4af38aac1566b08e..fbbe62a2a2851f36896f6f0627798a8a6607f1a9 100644 (file)
@@ -44,10 +44,9 @@ class WebPage;
 class WebPageOverlay : public API::ObjectImpl<API::Object::Type::BundlePageOverlay>, private WebCore::PageOverlay::Client {
 public:
     class Client {
-    protected:
+    public:
         virtual ~Client() { }
 
-    public:
         virtual void pageOverlayDestroyed(WebPageOverlay&) = 0;
         virtual void willMoveToPage(WebPageOverlay&, WebPage*) = 0;
         virtual void didMoveToPage(WebPageOverlay&, WebPage*) = 0;
@@ -67,7 +66,7 @@ public:
         virtual Vector<String> copyAccessibilityAttributeNames(WebPageOverlay&, bool /* parameterizedNames */) { return Vector<String>(); }
     };
 
-    static PassRefPtr<WebPageOverlay> create(Client&, WebCore::PageOverlay::OverlayType = WebCore::PageOverlay::OverlayType::View);
+    static PassRefPtr<WebPageOverlay> create(std::unique_ptr<Client>, WebCore::PageOverlay::OverlayType = WebCore::PageOverlay::OverlayType::View);
     static WebPageOverlay* fromCoreOverlay(WebCore::PageOverlay&);
     virtual ~WebPageOverlay();
 
@@ -77,7 +76,7 @@ public:
     void clear();
 
     WebCore::PageOverlay* coreOverlay() const { return m_overlay.get(); }
-    Client& client() const { return m_client; }
+    Client& client() const { return *m_client; }
 
 #if PLATFORM(MAC)
     DDActionContext *actionContextForResultAtPoint(WebCore::FloatPoint, RefPtr<WebCore::Range>&);
@@ -87,7 +86,7 @@ public:
 #endif
 
 private:
-    WebPageOverlay(Client&, WebCore::PageOverlay::OverlayType);
+    WebPageOverlay(std::unique_ptr<Client>, WebCore::PageOverlay::OverlayType);
 
     // WebCore::PageOverlay::Client
     virtual void pageOverlayDestroyed(WebCore::PageOverlay&) override;
@@ -103,7 +102,7 @@ private:
 
 
     RefPtr<WebCore::PageOverlay> m_overlay;
-    Client& m_client;
+    std::unique_ptr<Client> m_client;
 };
 
 } // namespace WebKit