-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adopt smart pointers in WebFullScreenManagerProxy.cpp, WebInspectorClient.cpp, WebInspectorInternal.cpp #47411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
EWS run on previous version of this PR (hash ee580ee) |
Safer C++ Build #42166 (ee580ee)❌ Found 2 failing files with 15 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
Didn't check all the failures in the analyzer results. They were spread out across the results and I didn't realize. Will address tomorrow. |
if (page && page->protectedInspector()) | ||
page->protectedInspector()->bringToFront(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (page && page->protectedInspector()) | |
page->protectedInspector()->bringToFront(); | |
if (!page) | |
return; | |
if (RefPtr inspector = page->inspector(); | |
inspector->bringToFront(); |
Is what we did elsewhere for cases like this. You should definitely never need a protected member just for a boolean output.
…ient.cpp, WebInspectorInternal.cpp https://bugs.webkit.org/show_bug.cgi?id=295243 rdar://154710862 Reviewed by NOBODY (OOPS!). Smart pointer adoption as per the static analyzer. * Source/WebKit/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations: * Source/WebKit/SaferCPPExpectations/UncountedCallArgsCheckerExpectations: * Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::isFullScreen): * Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::openLocalFrontend): (WebKit::WebInspectorClient::bringFrontendToFront): (WebKit::WebInspectorClient::didResizeMainFrame): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::elementSelectionChanged): (WebKit::WebInspectorClient::timelineRecordingChanged): (WebKit::WebInspectorClient::setDeveloperPreferenceOverride): * Source/WebKit/WebProcess/Inspector/WebInspectorInternal.cpp: (WebKit::WebInspector::~WebInspector): (WebKit::WebInspector::openLocalInspectorFrontend): (WebKit::WebInspector::closeFrontendConnection): (WebKit::WebInspector::bringToFront): (WebKit::WebInspector::showMainResourceForFrame): (WebKit::WebInspector::elementSelectionChanged): (WebKit::WebInspector::timelineRecordingChanged): (WebKit::WebInspector::setDeveloperPreferenceOverride): (WebKit::WebInspector::setEmulatedConditions): (WebKit::WebInspector::canAttachWindow): (WebKit::WebInspector::updateDockingAvailability): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::protectedInspector): (WebKit::WebPage::protectedInspectorUI): (WebKit::WebPage::protectedRemoteInspectorUI): * Source/WebKit/WebProcess/WebPage/WebPage.h:
ee580ee
to
51d2c6a
Compare
EWS run on current version of this PR (hash 51d2c6a) |
@@ -103,22 +103,28 @@ void WebInspectorClient::frontendCountChanged(unsigned count) | |||
Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller) | |||
{ | |||
if (RefPtr page = m_page.get()) | |||
page->inspector()->openLocalInspectorFrontend(); | |||
page->protectedInspector()->openLocalInspectorFrontend(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given it's on page()
I think that's warranted, might be worth a quick grep to confirm, but seems likely it's needed elsewhere.
Safer C++ Build #42214 (51d2c6a)❌ Found 1 failing file with 3 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
@@ -189,13 +195,13 @@ void WebInspectorClient::showPaintRect(const FloatRect& rect) | |||
|
|||
if (!m_paintRectOverlay) { | |||
m_paintRectOverlay = PageOverlay::create(*this, PageOverlay::OverlayType::Document); | |||
page->corePage()->pageOverlayController().installPageOverlay(*m_paintRectOverlay, PageOverlay::FadeMode::DoNotFade); | |||
page->corePage()->pageOverlayController().installPageOverlay(*(m_paintRectOverlay.copyRef()), PageOverlay::FadeMode::DoNotFade); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that you need m_paintRectOverlay
again below I'd write this as:
RefPtr paintRectOverlay = m_paintRectOverlay;
if (!paintRectOverlay)
paintRectOverlay = ...
m_paintRectOverlay = paintRectOverlay.copyRef();
...
... paintRectOverlay->layer();
I think that ends up being clearer overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo m_paintRectOverlay
nits this looks good to me. (Which I see now are also being flagged by the analyzer as wrong. Oops.)
@@ -80,7 +80,7 @@ WebInspectorClient::~WebInspectorClient() | |||
if (m_paintRectOverlay) { | |||
RefPtr page = m_page.get(); | |||
if (page && page->corePage()) | |||
page->corePage()->pageOverlayController().uninstallPageOverlay(*m_paintRectOverlay, PageOverlay::FadeMode::Fade); | |||
page->corePage()->pageOverlayController().uninstallPageOverlay(*(m_paintRectOverlay.copyRef()), PageOverlay::FadeMode::Fade); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should obtain a RefPtr
to m_paintRectOverlay
as part of the conditional above and deref that here.
51d2c6a
51d2c6a
🛠 playstation