Title: [234725] trunk/Source/WebKit
- Revision
- 234725
- Author
- [email protected]
- Date
- 2018-08-09 08:49:13 -0700 (Thu, 09 Aug 2018)
Log Message
DisplayRefreshMonitorMac should hold a weak pointer to WebPage.
https://bugs.webkit.org/show_bug.cgi?id=186683
Reviewed by Brent Fulgham.
Instead of DisplayRefreshMonitorMac having a RefPtr to WebPage, it should have a weak pointer.
Having a RefPtr could in theory create reference cycles. This potential problem has not been
observed in practice, but it is safer to use a weak pointer.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/DrawingAreaMac.cpp:
(WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
(WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (234724 => 234725)
--- trunk/Source/WebKit/ChangeLog 2018-08-09 14:01:51 UTC (rev 234724)
+++ trunk/Source/WebKit/ChangeLog 2018-08-09 15:49:13 UTC (rev 234725)
@@ -1,3 +1,20 @@
+2018-08-09 Per Arne Vollan <[email protected]>
+
+ DisplayRefreshMonitorMac should hold a weak pointer to WebPage.
+ https://bugs.webkit.org/show_bug.cgi?id=186683
+
+ Reviewed by Brent Fulgham.
+
+ Instead of DisplayRefreshMonitorMac having a RefPtr to WebPage, it should have a weak pointer.
+ Having a RefPtr could in theory create reference cycles. This potential problem has not been
+ observed in practice, but it is safer to use a weak pointer.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
+ (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
+ (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
+ (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
+
2018-08-09 Ali Juma <[email protected]>
Import WPTs for IntersectionObserver
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (234724 => 234725)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2018-08-09 14:01:51 UTC (rev 234724)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2018-08-09 15:49:13 UTC (rev 234725)
@@ -247,7 +247,7 @@
using SnapshotOptions = uint32_t;
using WKEventModifiers = uint32_t;
-class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender {
+class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
public:
static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
virtual ~WebPage();
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp (234724 => 234725)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp 2018-08-09 14:01:51 UTC (rev 234724)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp 2018-08-09 15:49:13 UTC (rev 234725)
@@ -57,7 +57,7 @@
bool hasRequestedRefreshCallback() const override { return m_hasSentMessage; }
- Ref<WebPage> m_webPage;
+ WeakPtr<WebPage> m_webPage;
bool m_hasSentMessage { false };
unsigned m_observerID;
static unsigned m_counterID;
@@ -69,7 +69,7 @@
DisplayRefreshMonitorMac::DisplayRefreshMonitorMac(PlatformDisplayID displayID, WebPage& webPage)
: DisplayRefreshMonitor(displayID)
- , m_webPage(webPage)
+ , m_webPage(makeWeakPtr(webPage))
, m_observerID(++m_counterID)
{
}
@@ -76,11 +76,18 @@
DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac()
{
+ if (!m_webPage)
+ return;
+
m_webPage->send(Messages::WebPageProxy::StopDisplayLink(m_observerID));
}
bool DisplayRefreshMonitorMac::requestRefreshCallback()
{
+ ASSERT(m_webPage);
+ if (!m_webPage)
+ return false;
+
if (!isActive())
return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes