<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180315] branches/safari-600.4.10-branch/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180315">180315</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2015-02-18 15:42:52 -0800 (Wed, 18 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/179952">r179952</a>.  rdar://problem/19771726</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari600410branchSourceWebKit2ChangeLog">branches/safari-600.4.10-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari600410branchSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlaycpp">branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp</a></li>
<li><a href="#branchessafari600410branchSourceWebKit2WebProcessWebPageWebPageOverlaycpp">branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp</a></li>
<li><a href="#branchessafari600410branchSourceWebKit2WebProcessWebPageWebPageOverlayh">branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari600410branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.4.10-branch/Source/WebKit2/ChangeLog (180314 => 180315)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.4.10-branch/Source/WebKit2/ChangeLog        2015-02-18 23:38:23 UTC (rev 180314)
+++ branches/safari-600.4.10-branch/Source/WebKit2/ChangeLog        2015-02-18 23:42:52 UTC (rev 180315)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-02-11  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r179586
+
+    2015-02-03  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+            Every PageOverlayClientImpl leaks
+            https://bugs.webkit.org/show_bug.cgi?id=141224
+            &lt;rdar://problem/19652939&gt;
+
+            Reviewed by Simon Fraser.
+
+            * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+            (WKBundlePageOverlayCreate):
+            * WebProcess/WebPage/WebPageOverlay.cpp:
+            (WebKit::WebPageOverlay::create):
+            (WebKit::WebPageOverlay::WebPageOverlay):
+            (WebKit::WebPageOverlay::pageOverlayDestroyed):
+            (WebKit::WebPageOverlay::willMoveToPage):
+            (WebKit::WebPageOverlay::didMoveToPage):
+            (WebKit::WebPageOverlay::drawRect):
+            (WebKit::WebPageOverlay::mouseEvent):
+            (WebKit::WebPageOverlay::didScrollFrame):
+            (WebKit::WebPageOverlay::actionContextForResultAtPoint):
+            (WebKit::WebPageOverlay::dataDetectorsDidPresentUI):
+            (WebKit::WebPageOverlay::dataDetectorsDidChangeUI):
+            (WebKit::WebPageOverlay::dataDetectorsDidHideUI):
+            (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint):
+            (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint):
+            (WebKit::WebPageOverlay::copyAccessibilityAttributeNames):
+            * WebProcess/WebPage/WebPageOverlay.h:
+            (WebKit::WebPageOverlay::client):
+            Keep the PageOverlayClientImpl as a unique_ptr instead of a leaked reference,
+            ensuring that it's cleaned up when the WebPageOverlay is torn down.
+
</ins><span class="cx"> 2015-02-18  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r177849
</span></span></pre></div>
<a id="branchessafari600410branchSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlaycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp (180314 => 180315)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2015-02-18 23:38:23 UTC (rev 180314)
+++ branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2015-02-18 23:42:52 UTC (rev 180315)
</span><span class="lines">@@ -223,9 +223,7 @@
</span><span class="cx"> WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClientBase* wkClient)
</span><span class="cx"> {
</span><span class="cx">     auto clientImpl = std::make_unique&lt;PageOverlayClientImpl&gt;(wkClient);
</span><del>-
-    // FIXME: Looks like this leaks the clientImpl.
-    return toAPI(WebPageOverlay::create(*clientImpl.release()).leakRef());
</del><ins>+    return toAPI(WebPageOverlay::create(WTF::move(clientImpl)).leakRef());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKBundlePageOverlaySetAccessibilityClient(WKBundlePageOverlayRef bundlePageOverlayRef, WKBundlePageOverlayAccessibilityClientBase* client)
</span></span></pre></div>
<a id="branchessafari600410branchSourceWebKit2WebProcessWebPageWebPageOverlaycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp (180314 => 180315)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp        2015-02-18 23:38:23 UTC (rev 180314)
+++ branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp        2015-02-18 23:42:52 UTC (rev 180315)
</span><span class="lines">@@ -42,15 +42,16 @@
</span><span class="cx">     return map;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageOverlay&gt; WebPageOverlay::create(WebPageOverlay::Client&amp; client, PageOverlay::OverlayType overlayType)
</del><ins>+PassRefPtr&lt;WebPageOverlay&gt; WebPageOverlay::create(std::unique_ptr&lt;WebPageOverlay::Client&gt; client, PageOverlay::OverlayType overlayType)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new WebPageOverlay(client, overlayType));
</del><ins>+    return adoptRef(new WebPageOverlay(WTF::move(client), overlayType));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageOverlay::WebPageOverlay(WebPageOverlay::Client&amp; client, PageOverlay::OverlayType overlayType)
</del><ins>+WebPageOverlay::WebPageOverlay(std::unique_ptr&lt;WebPageOverlay::Client&gt; client, PageOverlay::OverlayType overlayType)
</ins><span class="cx">     : m_overlay(PageOverlay::create(*this, overlayType))
</span><del>-    , m_client(client)
</del><ins>+    , m_client(WTF::move(client))
</ins><span class="cx"> {
</span><ins>+    ASSERT(m_client);
</ins><span class="cx">     overlayMap().add(m_overlay.get(), this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -90,69 +91,69 @@
</span><span class="cx">         m_overlay = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_client.pageOverlayDestroyed(*this);
</del><ins>+    m_client-&gt;pageOverlayDestroyed(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::willMoveToPage(PageOverlay&amp;, Page* page)
</span><span class="cx"> {
</span><del>-    m_client.willMoveToPage(*this, page ? WebPage::fromCorePage(page) : nullptr);
</del><ins>+    m_client-&gt;willMoveToPage(*this, page ? WebPage::fromCorePage(page) : nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::didMoveToPage(PageOverlay&amp;, Page* page)
</span><span class="cx"> {
</span><del>-    m_client.didMoveToPage(*this, page ? WebPage::fromCorePage(page) : nullptr);
</del><ins>+    m_client-&gt;didMoveToPage(*this, page ? WebPage::fromCorePage(page) : nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::drawRect(PageOverlay&amp;, GraphicsContext&amp; context, const IntRect&amp; dirtyRect)
</span><span class="cx"> {
</span><del>-    m_client.drawRect(*this, context, dirtyRect);
</del><ins>+    m_client-&gt;drawRect(*this, context, dirtyRect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebPageOverlay::mouseEvent(PageOverlay&amp;, const PlatformMouseEvent&amp; event)
</span><span class="cx"> {
</span><del>-    return m_client.mouseEvent(*this, event);
</del><ins>+    return m_client-&gt;mouseEvent(*this, event);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::didScrollFrame(PageOverlay&amp;, Frame&amp; frame)
</span><span class="cx"> {
</span><del>-    m_client.didScrollFrame(*this, WebFrame::fromCoreFrame(frame));
</del><ins>+    m_client-&gt;didScrollFrame(*this, WebFrame::fromCoreFrame(frame));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> DDActionContext *WebPageOverlay::actionContextForResultAtPoint(FloatPoint location, RefPtr&lt;WebCore::Range&gt;&amp; rangeHandle)
</span><span class="cx"> {
</span><del>-    return m_client.actionContextForResultAtPoint(*this, location, rangeHandle);
</del><ins>+    return m_client-&gt;actionContextForResultAtPoint(*this, location, rangeHandle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::dataDetectorsDidPresentUI()
</span><span class="cx"> {
</span><del>-    m_client.dataDetectorsDidPresentUI(*this);
</del><ins>+    m_client-&gt;dataDetectorsDidPresentUI(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::dataDetectorsDidChangeUI()
</span><span class="cx"> {
</span><del>-    m_client.dataDetectorsDidChangeUI(*this);
</del><ins>+    m_client-&gt;dataDetectorsDidChangeUI(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageOverlay::dataDetectorsDidHideUI()
</span><span class="cx"> {
</span><del>-    m_client.dataDetectorsDidHideUI(*this);
</del><ins>+    m_client-&gt;dataDetectorsDidHideUI(*this);
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> bool WebPageOverlay::copyAccessibilityAttributeStringValueForPoint(PageOverlay&amp;, String attribute, FloatPoint parameter, String&amp; value)
</span><span class="cx"> {
</span><del>-    return m_client.copyAccessibilityAttributeStringValueForPoint(*this, attribute, parameter, value);
</del><ins>+    return m_client-&gt;copyAccessibilityAttributeStringValueForPoint(*this, attribute, parameter, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint(PageOverlay&amp;, String attribute, FloatPoint parameter, bool&amp; value)
</span><span class="cx"> {
</span><del>-    return m_client.copyAccessibilityAttributeBoolValueForPoint(*this, attribute, parameter, value);
</del><ins>+    return m_client-&gt;copyAccessibilityAttributeBoolValueForPoint(*this, attribute, parameter, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;String&gt; WebPageOverlay::copyAccessibilityAttributeNames(PageOverlay&amp;, bool parameterizedNames)
</span><span class="cx"> {
</span><del>-    return m_client.copyAccessibilityAttributeNames(*this, parameterizedNames);
</del><ins>+    return m_client-&gt;copyAccessibilityAttributeNames(*this, parameterizedNames);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari600410branchSourceWebKit2WebProcessWebPageWebPageOverlayh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h (180314 => 180315)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h        2015-02-18 23:38:23 UTC (rev 180314)
+++ branches/safari-600.4.10-branch/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h        2015-02-18 23:42:52 UTC (rev 180315)
</span><span class="lines">@@ -44,10 +44,9 @@
</span><span class="cx"> class WebPageOverlay : public API::ObjectImpl&lt;API::Object::Type::BundlePageOverlay&gt;, private WebCore::PageOverlay::Client {
</span><span class="cx"> public:
</span><span class="cx">     class Client {
</span><del>-    protected:
</del><ins>+    public:
</ins><span class="cx">         virtual ~Client() { }
</span><span class="cx"> 
</span><del>-    public:
</del><span class="cx">         virtual void pageOverlayDestroyed(WebPageOverlay&amp;) = 0;
</span><span class="cx">         virtual void willMoveToPage(WebPageOverlay&amp;, WebPage*) = 0;
</span><span class="cx">         virtual void didMoveToPage(WebPageOverlay&amp;, WebPage*) = 0;
</span><span class="lines">@@ -67,7 +66,7 @@
</span><span class="cx">         virtual Vector&lt;String&gt; copyAccessibilityAttributeNames(WebPageOverlay&amp;, bool /* parameterizedNames */) { return Vector&lt;String&gt;(); }
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;WebPageOverlay&gt; create(Client&amp;, WebCore::PageOverlay::OverlayType = WebCore::PageOverlay::OverlayType::View);
</del><ins>+    static PassRefPtr&lt;WebPageOverlay&gt; create(std::unique_ptr&lt;Client&gt;, WebCore::PageOverlay::OverlayType = WebCore::PageOverlay::OverlayType::View);
</ins><span class="cx">     static WebPageOverlay* fromCoreOverlay(WebCore::PageOverlay&amp;);
</span><span class="cx">     virtual ~WebPageOverlay();
</span><span class="cx"> 
</span><span class="lines">@@ -77,7 +76,7 @@
</span><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx">     WebCore::PageOverlay* coreOverlay() const { return m_overlay.get(); }
</span><del>-    Client&amp; client() const { return m_client; }
</del><ins>+    Client&amp; client() const { return *m_client; }
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     DDActionContext *actionContextForResultAtPoint(WebCore::FloatPoint, RefPtr&lt;WebCore::Range&gt;&amp;);
</span><span class="lines">@@ -87,7 +86,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    WebPageOverlay(Client&amp;, WebCore::PageOverlay::OverlayType);
</del><ins>+    WebPageOverlay(std::unique_ptr&lt;Client&gt;, WebCore::PageOverlay::OverlayType);
</ins><span class="cx"> 
</span><span class="cx">     // WebCore::PageOverlay::Client
</span><span class="cx">     virtual void pageOverlayDestroyed(WebCore::PageOverlay&amp;) override;
</span><span class="lines">@@ -103,7 +102,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebCore::PageOverlay&gt; m_overlay;
</span><del>-    Client&amp; m_client;
</del><ins>+    std::unique_ptr&lt;Client&gt; m_client;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>