RESOLVED FIXED196042
Stop storing raw pointers to Documents
https://bugs.webkit.org/show_bug.cgi?id=196042
Summary Stop storing raw pointers to Documents
Alex Christensen
Reported 2019-03-20 16:12:25 PDT
Stop storing raw pointers to Documents
Attachments
Patch (19.07 KB, patch)
2019-03-20 16:13 PDT, Alex Christensen
no flags
Patch (18.50 KB, patch)
2019-03-20 16:55 PDT, Alex Christensen
ggaren: review+
Alex Christensen
Comment 1 2019-03-20 16:13:29 PDT
Chris Dumez
Comment 2 2019-03-20 16:14:38 PDT
Comment on attachment 365427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365427&action=review > Source/WebCore/Modules/websockets/WebSocketChannel.cpp:372 > + didCloseSocketStream(handle); Did you mean to include this?
Geoffrey Garen
Comment 3 2019-03-20 16:53:11 PDT
Comment on attachment 365427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365427&action=review r=me >> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:372 >> + didCloseSocketStream(handle); > > Did you mean to include this? Plz delete.
Alex Christensen
Comment 4 2019-03-20 16:55:34 PDT
Daniel Bates
Comment 5 2019-03-20 18:46:19 PDT
Comment on attachment 365440 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365440&action=review > Source/WebCore/loader/MediaResourceLoader.h:55 > + Document* document() const { return m_document.get(); } Why? To fix the build? :D If so, what's the caller that needs this? If not, this code is correct as-is and you're making it wrong.
Daniel Bates
Comment 6 2019-03-20 18:47:19 PDT
(In reply to Daniel Bates from comment #5) > Comment on attachment 365440 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=365440&action=review > > > Source/WebCore/loader/MediaResourceLoader.h:55 > > + Document* document() const { return m_document.get(); } > > Why? To fix the build? :D If so, what's the caller that needs this? If not, > this code is correct as-is and you're making it wrong. Talk to me in person if you need to know why it's wrong.
Alex Christensen
Comment 7 2019-03-22 10:12:48 PDT
Comment on attachment 365440 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365440&action=review >>> Source/WebCore/loader/MediaResourceLoader.h:55 >>> + Document* document() const { return m_document.get(); } >> >> Why? To fix the build? :D If so, what's the caller that needs this? If not, this code is correct as-is and you're making it wrong. > > Talk to me in person if you need to know why it's wrong. I'm not sure what you're referring to. I'm adding const because I can and because it's an accessor that doesn't modify the object. I'm adding the .get() because m_document is now a WeakPtr and this function returns a pointer, so I need the .get().
Geoffrey Garen
Comment 8 2019-03-22 10:34:56 PDT
Comment on attachment 365440 [details] Patch r=me, seems worth following up with Dan to understand why he though const was "wrong"
Chris Dumez
Comment 9 2019-03-22 10:40:21 PDT
Comment on attachment 365440 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365440&action=review >>>> Source/WebCore/loader/MediaResourceLoader.h:55 >>>> + Document* document() const { return m_document.get(); } >>> >>> Why? To fix the build? :D If so, what's the caller that needs this? If not, this code is correct as-is and you're making it wrong. >> >> Talk to me in person if you need to know why it's wrong. > > I'm not sure what you're referring to. I'm adding const because I can and because it's an accessor that doesn't modify the object. I'm adding the .get() because m_document is now a WeakPtr and this function returns a pointer, so I need the .get(). I think people have different views about what const-correct means. I personally think the new code is less const correct since it is returning a non const data member in a const method.
Daniel Bates
Comment 10 2019-03-22 13:46:28 PDT
(In reply to Chris Dumez from comment #9) > I > personally think the new code is less const correct since it is returning a > non const data member in a const method. Bingo! 👍
Alex Christensen
Comment 11 2019-03-25 14:22:21 PDT
Removed the controversial const and committed to http://trac.webkit.org/r243459
Radar WebKit Bug Importer
Comment 12 2019-03-25 14:23:45 PDT
Note You need to log in before you can comment on or make changes to this bug.