Title: [183179] trunk/Source
Revision
183179
Author
[email protected]
Date
2015-04-23 01:12:30 -0700 (Thu, 23 Apr 2015)

Log Message

[WK2] WebDiagnosticLoggingClient is leaking
https://bugs.webkit.org/show_bug.cgi?id=144089
<rdar://problem/19706214>

Reviewed by Darin Adler.

WebDiagnosticLoggingClient is leaking. It is constructed inside WebPage
constructor but there is no code destroying it.

This patch adds a new xxxDestroyed() virtual function to
DiagnosticLoggingClient and that is overriden in
WebDiagnosticLoggingClient to call "delete this". This is the same
pattern as for other WK2 clients (e.g. WebFrameLoaderClient,
WebProgressTrackerClient).

Source/WebCore:

* loader/EmptyClients.h:
* page/DiagnosticLoggingClient.h:
* page/MainFrame.cpp:
(WebCore::MainFrame::~MainFrame):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
(WebKit::WebDiagnosticLoggingClient::mainFrameDestroyed):
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183178 => 183179)


--- trunk/Source/WebCore/ChangeLog	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebCore/ChangeLog	2015-04-23 08:12:30 UTC (rev 183179)
@@ -1,3 +1,25 @@
+2015-04-23  Chris Dumez  <[email protected]>
+
+        [WK2] WebDiagnosticLoggingClient is leaking
+        https://bugs.webkit.org/show_bug.cgi?id=144089
+        <rdar://problem/19706214>
+
+        Reviewed by Darin Adler.
+
+        WebDiagnosticLoggingClient is leaking. It is constructed inside WebPage
+        constructor but there is no code destroying it.
+
+        This patch adds a new xxxDestroyed() virtual function to
+        DiagnosticLoggingClient and that is overriden in
+        WebDiagnosticLoggingClient to call "delete this". This is the same
+        pattern as for other WK2 clients (e.g. WebFrameLoaderClient,
+        WebProgressTrackerClient).
+
+        * loader/EmptyClients.h:
+        * page/DiagnosticLoggingClient.h:
+        * page/MainFrame.cpp:
+        (WebCore::MainFrame::~MainFrame):
+
 2015-04-22  Antti Koivisto  <[email protected]>
 
         CrashTracer: WebProcess at com.apple.WebCore: WebCore::toScriptElementIfPossible + 4

Modified: trunk/Source/WebCore/loader/EmptyClients.h (183178 => 183179)


--- trunk/Source/WebCore/loader/EmptyClients.h	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2015-04-23 08:12:30 UTC (rev 183179)
@@ -634,6 +634,8 @@
     virtual void logDiagnosticMessage(const String&, const String&, ShouldSample) override { }
     virtual void logDiagnosticMessageWithResult(const String&, const String&, DiagnosticLoggingResultType, ShouldSample) override { }
     virtual void logDiagnosticMessageWithValue(const String&, const String&, const String&, ShouldSample) override { }
+
+    virtual void mainFrameDestroyed() override { }
 };
 
 void fillWithEmptyClients(PageConfiguration&);

Modified: trunk/Source/WebCore/page/DiagnosticLoggingClient.h (183178 => 183179)


--- trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2015-04-23 08:12:30 UTC (rev 183179)
@@ -39,6 +39,8 @@
     virtual void logDiagnosticMessageWithResult(const String& message, const String& description, DiagnosticLoggingResultType, ShouldSample) = 0;
     virtual void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, ShouldSample) = 0;
 
+    virtual void mainFrameDestroyed() = 0;
+
 protected:
     virtual ~DiagnosticLoggingClient() { }
 };

Modified: trunk/Source/WebCore/page/MainFrame.cpp (183178 => 183179)


--- trunk/Source/WebCore/page/MainFrame.cpp	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebCore/page/MainFrame.cpp	2015-04-23 08:12:30 UTC (rev 183179)
@@ -58,6 +58,8 @@
 
 MainFrame::~MainFrame()
 {
+    if (m_diagnosticLoggingClient)
+        m_diagnosticLoggingClient->mainFrameDestroyed();
 }
 
 RefPtr<MainFrame> MainFrame::create(Page& page, PageConfiguration& configuration)

Modified: trunk/Source/WebKit2/ChangeLog (183178 => 183179)


--- trunk/Source/WebKit2/ChangeLog	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-23 08:12:30 UTC (rev 183179)
@@ -1,3 +1,24 @@
+2015-04-23  Chris Dumez  <[email protected]>
+
+        [WK2] WebDiagnosticLoggingClient is leaking
+        https://bugs.webkit.org/show_bug.cgi?id=144089
+        <rdar://problem/19706214>
+
+        Reviewed by Darin Adler.
+
+        WebDiagnosticLoggingClient is leaking. It is constructed inside WebPage
+        constructor but there is no code destroying it.
+
+        This patch adds a new xxxDestroyed() virtual function to
+        DiagnosticLoggingClient and that is overriden in
+        WebDiagnosticLoggingClient to call "delete this". This is the same
+        pattern as for other WK2 clients (e.g. WebFrameLoaderClient,
+        WebProgressTrackerClient).
+
+        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
+        (WebKit::WebDiagnosticLoggingClient::mainFrameDestroyed):
+        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
+
 2015-04-23  Carlos Garcia Campos  <[email protected]>
 
         [UNIX] Simplify the file descriptor handling in SharedMemory

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp (183178 => 183179)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp	2015-04-23 08:12:30 UTC (rev 183179)
@@ -71,4 +71,9 @@
     m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithValue(message, description, value, shouldSample == WebCore::ShouldSample::Yes));
 }
 
+void WebDiagnosticLoggingClient::mainFrameDestroyed()
+{
+    delete this;
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h (183178 => 183179)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h	2015-04-23 07:57:57 UTC (rev 183178)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h	2015-04-23 08:12:30 UTC (rev 183179)
@@ -43,6 +43,8 @@
     virtual void logDiagnosticMessageWithResult(const String& message, const String& description, WebCore::DiagnosticLoggingResultType, WebCore::ShouldSample) override;
     virtual void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, WebCore::ShouldSample) override;
 
+    virtual void mainFrameDestroyed() override;
+
     WebPage& m_page;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to