Title: [253048] trunk/Source
Revision
253048
Author
cdu...@apple.com
Date
2019-12-03 09:34:46 -0800 (Tue, 03 Dec 2019)

Log Message

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

Reviewed by Anders Carlsson.

Source/WebCore:

* page/AlternativeTextClient.h:
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
* page/Page.h:
(WebCore::Page::alternativeTextClient const):
* page/PageConfiguration.h:

Source/WebKit:

* WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
* WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp:
(WebKit::WebAlternativeTextClient::pageDestroyed): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_overriddenMediaType):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebAlternativeTextClient.h:
* WebCoreSupport/WebAlternativeTextClient.mm:
(WebAlternativeTextClient::pageDestroyed): Deleted.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253047 => 253048)


--- trunk/Source/WebCore/ChangeLog	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebCore/ChangeLog	2019-12-03 17:34:46 UTC (rev 253048)
@@ -1,3 +1,18 @@
+2019-12-03  Chris Dumez  <cdu...@apple.com>
+
+        PageConfiguration::alternativeTextClient should use a smart pointer
+        https://bugs.webkit.org/show_bug.cgi?id=204777
+
+        Reviewed by Anders Carlsson.
+
+        * page/AlternativeTextClient.h:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::~Page):
+        * page/Page.h:
+        (WebCore::Page::alternativeTextClient const):
+        * page/PageConfiguration.h:
+
 2019-12-03  Tim Horton  <timothy_hor...@apple.com>
 
         Start adding encoding support for DisplayList and some DisplayListItems

Modified: trunk/Source/WebCore/page/AlternativeTextClient.h (253047 => 253048)


--- trunk/Source/WebCore/page/AlternativeTextClient.h	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebCore/page/AlternativeTextClient.h	2019-12-03 17:34:46 UTC (rev 253048)
@@ -53,7 +53,6 @@
 class AlternativeTextClient {
 public:
     virtual ~AlternativeTextClient() = default;
-    virtual void pageDestroyed() = 0;
 #if USE(AUTOCORRECTION_PANEL)
     virtual void showCorrectionAlternative(AlternativeTextType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, const Vector<String>& alternativeReplacementStrings) = 0;
     virtual void dismissAlternative(ReasonForDismissingAlternativeText) = 0;

Modified: trunk/Source/WebCore/page/Page.cpp (253047 => 253048)


--- trunk/Source/WebCore/page/Page.cpp	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebCore/page/Page.cpp	2019-12-03 17:34:46 UTC (rev 253048)
@@ -253,7 +253,7 @@
     , m_domTimerAlignmentInterval(DOMTimer::defaultAlignmentInterval())
     , m_domTimerAlignmentIntervalIncreaseTimer(*this, &Page::domTimerAlignmentIntervalIncreaseTimerFired)
     , m_activityState(pageInitialActivityState())
-    , m_alternativeTextClient(pageConfiguration.alternativeTextClient)
+    , m_alternativeTextClient(WTFMove(pageConfiguration.alternativeTextClient))
     , m_consoleClient(makeUnique<PageConsoleClient>(*this))
 #if ENABLE(REMOTE_INSPECTOR)
     , m_inspectorDebuggable(makeUnique<PageDebuggable>(*this))
@@ -355,8 +355,6 @@
 
     if (m_plugInClient)
         m_plugInClient->pageDestroyed();
-    if (m_alternativeTextClient)
-        m_alternativeTextClient->pageDestroyed();
 
     if (m_scrollingCoordinator)
         m_scrollingCoordinator->pageDestroyed();

Modified: trunk/Source/WebCore/page/Page.h (253047 => 253048)


--- trunk/Source/WebCore/page/Page.h	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebCore/page/Page.h	2019-12-03 17:34:46 UTC (rev 253048)
@@ -556,7 +556,7 @@
     bool isPainting() const { return m_isPainting; }
 #endif
 
-    AlternativeTextClient* alternativeTextClient() const { return m_alternativeTextClient; }
+    AlternativeTextClient* alternativeTextClient() const { return m_alternativeTextClient.get(); }
 
     bool hasSeenPlugin(const String& serviceType) const;
     WEBCORE_EXPORT bool hasSeenAnyPlugin() const;
@@ -900,7 +900,7 @@
 #ifndef NDEBUG
     bool m_isPainting { false };
 #endif
-    AlternativeTextClient* m_alternativeTextClient;
+    std::unique_ptr<AlternativeTextClient> m_alternativeTextClient;
 
     bool m_scriptedAnimationsSuspended { false };
     const std::unique_ptr<PageConsoleClient> m_consoleClient;

Modified: trunk/Source/WebCore/page/PageConfiguration.h (253047 => 253048)


--- trunk/Source/WebCore/page/PageConfiguration.h	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebCore/page/PageConfiguration.h	2019-12-03 17:34:46 UTC (rev 253048)
@@ -73,7 +73,7 @@
     PageConfiguration(PageConfiguration&&);
 
     PAL::SessionID sessionID;
-    AlternativeTextClient* alternativeTextClient { nullptr };
+    std::unique_ptr<AlternativeTextClient> alternativeTextClient;
     ChromeClient* chromeClient { nullptr };
 #if ENABLE(CONTEXT_MENUS)
     ContextMenuClient* contextMenuClient { nullptr };

Modified: trunk/Source/WebKit/ChangeLog (253047 => 253048)


--- trunk/Source/WebKit/ChangeLog	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKit/ChangeLog	2019-12-03 17:34:46 UTC (rev 253048)
@@ -1,3 +1,16 @@
+2019-12-03  Chris Dumez  <cdu...@apple.com>
+
+        PageConfiguration::alternativeTextClient should use a smart pointer
+        https://bugs.webkit.org/show_bug.cgi?id=204777
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
+        * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp:
+        (WebKit::WebAlternativeTextClient::pageDestroyed): Deleted.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_overriddenMediaType):
+
 2019-12-03  Kate Cheney  <katherine_che...@apple.com>
 
         Activate the SQLite database as an on-by-default feature

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebAlternativeTextClient.h (253047 => 253048)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebAlternativeTextClient.h	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebAlternativeTextClient.h	2019-12-03 17:34:46 UTC (rev 253048)
@@ -36,7 +36,6 @@
 public:
     explicit WebAlternativeTextClient(WebPage*);
     virtual ~WebAlternativeTextClient();
-    void pageDestroyed() override;
 #if USE(AUTOCORRECTION_PANEL)
     void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
     void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp (253047 => 253048)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp	2019-12-03 17:34:46 UTC (rev 253048)
@@ -45,11 +45,6 @@
 #endif
 }
 
-void WebAlternativeTextClient::pageDestroyed()
-{
-    delete this;
-}
-
 #if USE(AUTOCORRECTION_PANEL)
 void WebAlternativeTextClient::showCorrectionAlternative(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
 {

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (253047 => 253048)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-12-03 17:34:46 UTC (rev 253048)
@@ -460,7 +460,7 @@
 #endif
     pageConfiguration.inspectorClient = new WebInspectorClient(this);
 #if USE(AUTOCORRECTION_PANEL)
-    pageConfiguration.alternativeTextClient = new WebAlternativeTextClient(this);
+    pageConfiguration.alternativeTextClient = makeUnique<WebAlternativeTextClient>(this);
 #endif
 
     pageConfiguration.plugInClient = new WebPlugInClient(*this);

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (253047 => 253048)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-12-03 17:34:46 UTC (rev 253048)
@@ -1,3 +1,16 @@
+2019-12-03  Chris Dumez  <cdu...@apple.com>
+
+        PageConfiguration::alternativeTextClient should use a smart pointer
+        https://bugs.webkit.org/show_bug.cgi?id=204777
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebAlternativeTextClient.h:
+        * WebCoreSupport/WebAlternativeTextClient.mm:
+        (WebAlternativeTextClient::pageDestroyed): Deleted.
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+
 2019-12-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [PSON] Tooltips from previous page shown on new page

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.h (253047 => 253048)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.h	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.h	2019-12-03 17:34:46 UTC (rev 253048)
@@ -35,7 +35,6 @@
 public:
     explicit WebAlternativeTextClient(WebView*);
     virtual ~WebAlternativeTextClient();
-    void pageDestroyed() override;
 #if USE(AUTOCORRECTION_PANEL)
     void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
     void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.mm (253047 => 253048)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.mm	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebAlternativeTextClient.mm	2019-12-03 17:34:46 UTC (rev 253048)
@@ -41,11 +41,6 @@
 #endif
 }
 
-void WebAlternativeTextClient::pageDestroyed()
-{
-    delete this;
-}
-
 #if USE(AUTOCORRECTION_PANEL)
 void WebAlternativeTextClient::showCorrectionAlternative(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
 {

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (253047 => 253048)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-12-03 17:12:40 UTC (rev 253047)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-12-03 17:34:46 UTC (rev 253048)
@@ -1458,7 +1458,7 @@
     pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinatorClient();
 #endif
 
-    pageConfiguration.alternativeTextClient = new WebAlternativeTextClient(self);
+    pageConfiguration.alternativeTextClient = makeUnique<WebAlternativeTextClient>(self);
     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
     pageConfiguration.applicationCacheStorage = &webApplicationCacheStorage();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to