RESOLVED FIXED 99239
NamedFlowCollection should be a ContextDestructionObserver
https://bugs.webkit.org/show_bug.cgi?id=99239
Summary NamedFlowCollection should be a ContextDestructionObserver
WebKit Review Bot
Reported 2012-10-13 00:17:13 PDT
NamedFlowCollection should be a ContextDestructionObserver Requested by abarth on #webkit.
Attachments
Patch (3.17 KB, patch)
2013-02-07 05:43 PST, Hanyee Kim
no flags
Patch (4.95 KB, patch)
2013-02-07 20:34 PST, Hanyee Kim
no flags
Hanyee Kim
Comment 1 2013-02-07 05:43:27 PST
Mihnea Ovidenie
Comment 2 2013-02-07 06:36:48 PST
I think an explanation about why this change is needed would be helpful.
Adam Barth
Comment 3 2013-02-07 11:11:35 PST
Comment on attachment 187076 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187076&action=review > Source/WebCore/dom/NamedFlowCollection.cpp:43 > NamedFlowCollection::NamedFlowCollection(Document* doc) doc -> document > Source/WebCore/dom/NamedFlowCollection.cpp:45 > + , m_document(doc) You don't need the m_document variable anymore. ContextDestructionObserver already keep that information for you. > Source/WebCore/dom/NamedFlowCollection.cpp:107 > -void NamedFlowCollection::documentDestroyed() > +void NamedFlowCollection::contextDestroyed() > { > m_document = 0; > } Once you remove m_document, you can delete this function.
Adam Barth
Comment 4 2013-02-07 11:12:10 PST
> I think an explanation about why this change is needed would be helpful. This class just re-implements ContextDestructionObserver manually. Instead of re-implementing ContextDestructionObserver, we can just subclass it.
Adam Barth
Comment 5 2013-02-07 11:13:45 PST
We're trying to remove as many of the raw Document* member variables as we can from WebCore because those raw pointers often lead to memory corruption. This case doesn't cause memory corruption because NamedFlowCollection clears the pointer when the Document is destroyed. However, it's easier to audit these cases if we let ContextDestructionObserver do that work automatically.
Hanyee Kim
Comment 6 2013-02-07 20:32:51 PST
Your comment is helpful to understand about ContextDestructionContext perfectly. Thanks for reviewing!! I will upload new patch.
Hanyee Kim
Comment 7 2013-02-07 20:34:01 PST
Adam Barth
Comment 8 2013-02-07 20:42:40 PST
Comment on attachment 187226 [details] Patch looks great
WebKit Review Bot
Comment 9 2013-02-07 21:01:00 PST
Comment on attachment 187226 [details] Patch Clearing flags on attachment: 187226 Committed r142223: <http://trac.webkit.org/changeset/142223>
WebKit Review Bot
Comment 10 2013-02-07 21:01:05 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.