Title: [253051] trunk/Source
Revision
253051
Author
cdu...@apple.com
Date
2019-12-03 10:17:38 -0800 (Tue, 03 Dec 2019)

Log Message

PageConfiguration::pluginClient should use a smart pointer
https://bugs.webkit.org/show_bug.cgi?id=204780

Reviewed by Anders Carlsson.

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
* page/Page.h:
(WebCore::Page::plugInClient const):
* page/PageConfiguration.h:
* page/PlugInClient.h:

Source/WebKit:

* WebProcess/WebCoreSupport/WebPlugInClient.cpp:
* WebProcess/WebCoreSupport/WebPlugInClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_overriddenMediaType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253050 => 253051)


--- trunk/Source/WebCore/ChangeLog	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebCore/ChangeLog	2019-12-03 18:17:38 UTC (rev 253051)
@@ -1,3 +1,18 @@
+2019-12-03  Chris Dumez  <cdu...@apple.com>
+
+        PageConfiguration::pluginClient should use a smart pointer
+        https://bugs.webkit.org/show_bug.cgi?id=204780
+
+        Reviewed by Anders Carlsson.
+
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::~Page):
+        * page/Page.h:
+        (WebCore::Page::plugInClient const):
+        * page/PageConfiguration.h:
+        * page/PlugInClient.h:
+
 2019-12-03  Dean Jackson  <d...@apple.com>
 
         Fix MacCatalyst build.

Modified: trunk/Source/WebCore/page/Page.cpp (253050 => 253051)


--- trunk/Source/WebCore/page/Page.cpp	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebCore/page/Page.cpp	2019-12-03 18:17:38 UTC (rev 253051)
@@ -237,7 +237,7 @@
     , m_backForwardController(makeUnique<BackForwardController>(*this, WTFMove(pageConfiguration.backForwardClient)))
     , m_mainFrame(Frame::create(this, nullptr, pageConfiguration.loaderClientForMainFrame))
     , m_editorClient(WTFMove(pageConfiguration.editorClient))
-    , m_plugInClient(pageConfiguration.plugInClient)
+    , m_plugInClient(WTFMove(pageConfiguration.plugInClient))
     , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
     , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
     , m_performanceLoggingClient(WTFMove(pageConfiguration.performanceLoggingClient))
@@ -353,9 +353,6 @@
         frame->detachFromPage();
     }
 
-    if (m_plugInClient)
-        m_plugInClient->pageDestroyed();
-
     if (m_scrollingCoordinator)
         m_scrollingCoordinator->pageDestroyed();
 

Modified: trunk/Source/WebCore/page/Page.h (253050 => 253051)


--- trunk/Source/WebCore/page/Page.h	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebCore/page/Page.h	2019-12-03 18:17:38 UTC (rev 253051)
@@ -204,7 +204,7 @@
     bool canStartMedia() const { return m_canStartMedia; }
 
     EditorClient& editorClient() { return m_editorClient.get(); }
-    PlugInClient* plugInClient() const { return m_plugInClient; }
+    PlugInClient* plugInClient() const { return m_plugInClient.get(); }
 
     Frame& mainFrame() { return m_mainFrame.get(); }
     const Frame& mainFrame() const { return m_mainFrame.get(); }
@@ -792,7 +792,7 @@
     RefPtr<PluginData> m_pluginData;
 
     UniqueRef<EditorClient> m_editorClient;
-    PlugInClient* m_plugInClient;
+    std::unique_ptr<PlugInClient> m_plugInClient;
     std::unique_ptr<ValidationMessageClient> m_validationMessageClient;
     std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
     std::unique_ptr<PerformanceLoggingClient> m_performanceLoggingClient;

Modified: trunk/Source/WebCore/page/PageConfiguration.h (253050 => 253051)


--- trunk/Source/WebCore/page/PageConfiguration.h	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebCore/page/PageConfiguration.h	2019-12-03 18:17:38 UTC (rev 253051)
@@ -96,7 +96,7 @@
 
     UniqueRef<LibWebRTCProvider> libWebRTCProvider;
 
-    PlugInClient* plugInClient { nullptr };
+    std::unique_ptr<PlugInClient> plugInClient;
     ProgressTrackerClient* progressTrackerClient { nullptr };
     Ref<BackForwardClient> backForwardClient;
     Ref<CookieJar> cookieJar;

Modified: trunk/Source/WebCore/page/PlugInClient.h (253050 => 253051)


--- trunk/Source/WebCore/page/PlugInClient.h	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebCore/page/PlugInClient.h	2019-12-03 18:17:38 UTC (rev 253051)
@@ -31,12 +31,9 @@
 
 class PlugInClient {
 public:
-    virtual void pageDestroyed() = 0;
+    virtual ~PlugInClient() = default;
     virtual bool shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) = 0;
     virtual void didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) = 0;
-
-protected:
-    virtual ~PlugInClient() = default;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (253050 => 253051)


--- trunk/Source/WebKit/ChangeLog	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebKit/ChangeLog	2019-12-03 18:17:38 UTC (rev 253051)
@@ -1,5 +1,17 @@
 2019-12-03  Chris Dumez  <cdu...@apple.com>
 
+        PageConfiguration::pluginClient should use a smart pointer
+        https://bugs.webkit.org/show_bug.cgi?id=204780
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebCoreSupport/WebPlugInClient.cpp:
+        * WebProcess/WebCoreSupport/WebPlugInClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_overriddenMediaType):
+
+2019-12-03  Chris Dumez  <cdu...@apple.com>
+
         PageConfiguration::alternativeTextClient should use a smart pointer
         https://bugs.webkit.org/show_bug.cgi?id=204777
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.cpp (253050 => 253051)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.cpp	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.cpp	2019-12-03 18:17:38 UTC (rev 253051)
@@ -43,11 +43,6 @@
 {
 }
 
-void WebPlugInClient::pageDestroyed()
-{
-    delete this;
-}
-
 bool WebPlugInClient::shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType)
 {
     return WebProcess::singleton().shouldPlugInAutoStartFromOrigin(m_webPage, pageOrigin, pluginOrigin, mimeType);

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.h (253050 => 253051)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.h	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlugInClient.h	2019-12-03 18:17:38 UTC (rev 253051)
@@ -39,7 +39,6 @@
     virtual ~WebPlugInClient();
 
 private:
-    void pageDestroyed() override;
     bool shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) override;
     void didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) override;
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (253050 => 253051)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-12-03 18:13:08 UTC (rev 253050)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-12-03 18:17:38 UTC (rev 253051)
@@ -463,7 +463,7 @@
     pageConfiguration.alternativeTextClient = makeUnique<WebAlternativeTextClient>(this);
 #endif
 
-    pageConfiguration.plugInClient = new WebPlugInClient(*this);
+    pageConfiguration.plugInClient = makeUnique<WebPlugInClient>(*this);
     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
     pageConfiguration.diagnosticLoggingClient = makeUnique<WebDiagnosticLoggingClient>(*this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to