WebKit Bugzilla
Attachment 339390 Details for
Bug 185239
: Widgets should hold a WeakPtr to their parents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185239-20180502232626.patch (text/plain), 4.14 KB, created by
Brent Fulgham
on 2018-05-02 23:26:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2018-05-02 23:26:27 PDT
Size:
4.14 KB
patch
obsolete
>Subversion Revision: 231257 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e3b8f897267a5316b6a95e019e59b51318c80eb2..20f15e8e42d6315cd7108de5e2bc65fbf4ca4e82 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-02 Brent Fulgham <bfulgham@apple.com> >+ >+ Widgets should hold a WeakPtr to their parents >+ https://bugs.webkit.org/show_bug.cgi?id=185239 >+ <rdar://problem/39741250> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/ScrollView.h: >+ (WebCore::ScrollView::createWeakPtr): Added. >+ * platform/Widget.cpp: >+ (WebCore::Widget::init): Use nullptr rather than 0. >+ (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView. >+ * platform/Widget.h: >+ (WebCore::Widget::parent const): Change type to a WeakPtr. >+ > 2018-05-02 Brian Burg <bburg@apple.com> > > Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected >diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h >index 6d1da5be53a1e13cb31c29008c4fd919d6428de2..29eecad306389267ca673b8cd47777ba3ec3b29a 100644 >--- a/Source/WebCore/platform/ScrollView.h >+++ b/Source/WebCore/platform/ScrollView.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * Copyright (C) 2009 Holger Hans Peter Freyther > * > * Redistribution and use in source and binary forms, with or without >@@ -33,6 +33,7 @@ > #include "ScrollTypes.h" > #include "Widget.h" > #include <wtf/HashSet.h> >+#include <wtf/WeakPtr.h> > > #if PLATFORM(IOS) > >@@ -371,6 +372,8 @@ public: > void setAllowsUnclampedScrollPositionForTesting(bool allowsUnclampedScrollPosition) { m_allowsUnclampedScrollPosition = allowsUnclampedScrollPosition; } > bool allowsUnclampedScrollPosition() const { return m_allowsUnclampedScrollPosition; } > >+ WeakPtr<ScrollView> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); } >+ > protected: > ScrollView(); > >@@ -457,6 +460,8 @@ private: > > IntPoint m_panScrollIconPoint; > >+ WeakPtrFactory<ScrollView> m_weakPtrFactory; >+ > bool m_horizontalScrollbarLock { false }; > bool m_verticalScrollbarLock { false }; > >diff --git a/Source/WebCore/platform/Widget.cpp b/Source/WebCore/platform/Widget.cpp >index 9f1d014825b530ca2eac24438f4a7e017b8770ba..ebc08dc5151613689d86fcd1050a1c0e40dc3fa2 100644 >--- a/Source/WebCore/platform/Widget.cpp >+++ b/Source/WebCore/platform/Widget.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -34,7 +34,7 @@ namespace WebCore { > > void Widget::init(PlatformWidget widget) > { >- m_parent = 0; >+ m_parent = nullptr; > m_selfVisible = false; > m_parentVisible = false; > m_widget = widget; >@@ -47,7 +47,7 @@ void Widget::setParent(ScrollView* view) > ASSERT(!view || !m_parent); > if (!view || !view->isVisible()) > setParentVisible(false); >- m_parent = view; >+ m_parent = view ? view->createWeakPtr() : nullptr; > if (view && view->isVisible()) > setParentVisible(true); > } >diff --git a/Source/WebCore/platform/Widget.h b/Source/WebCore/platform/Widget.h >index 3810919c017bdf16fcb94dfe8029874247c5a403..2b2f1e4e6d7f9f776ba4aaac3171b64f6a2f2fbb 100644 >--- a/Source/WebCore/platform/Widget.h >+++ b/Source/WebCore/platform/Widget.h >@@ -140,7 +140,7 @@ public: > > WEBCORE_EXPORT void removeFromParent(); > WEBCORE_EXPORT virtual void setParent(ScrollView* view); >- ScrollView* parent() const { return m_parent; } >+ ScrollView* parent() const { return m_parent.get(); } > FrameView* root() const; > > virtual void handleEvent(Event&) { } >@@ -204,7 +204,7 @@ private: > static IntPoint convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint&); > > private: >- ScrollView* m_parent; >+ WeakPtr<ScrollView> m_parent; > #if !PLATFORM(COCOA) > PlatformWidget m_widget; > #else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
zalan
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185239
: 339390