Remove web_contents_impl() helper to clarify code and remove unnecessary guard
This commit is contained in:
parent
406f171c88
commit
df3d94b20d
2 changed files with 10 additions and 32 deletions
|
@ -1652,12 +1652,8 @@ void WebContents::StartPainting() {
|
|||
return;
|
||||
|
||||
#if defined(ENABLE_OSR)
|
||||
const auto* wc_impl = web_contents_impl();
|
||||
if (!wc_impl)
|
||||
return;
|
||||
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
||||
wc_impl->GetView());
|
||||
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||
if (osr_wcv)
|
||||
osr_wcv->SetPainting(true);
|
||||
#endif
|
||||
|
@ -1668,12 +1664,8 @@ void WebContents::StopPainting() {
|
|||
return;
|
||||
|
||||
#if defined(ENABLE_OSR)
|
||||
const auto* wc_impl = web_contents_impl();
|
||||
if (!wc_impl)
|
||||
return;
|
||||
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
||||
wc_impl->GetView());
|
||||
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||
if (osr_wcv)
|
||||
osr_wcv->SetPainting(false);
|
||||
#endif
|
||||
|
@ -1684,12 +1676,9 @@ bool WebContents::IsPainting() const {
|
|||
return false;
|
||||
|
||||
#if defined(ENABLE_OSR)
|
||||
const auto* wc_impl = web_contents_impl();
|
||||
if (!wc_impl)
|
||||
return false;
|
||||
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||
|
||||
const auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
||||
wc_impl->GetView());
|
||||
return osr_wcv && osr_wcv->IsPainting();
|
||||
#else
|
||||
return false;
|
||||
|
@ -1701,12 +1690,9 @@ void WebContents::SetFrameRate(int frame_rate) {
|
|||
return;
|
||||
|
||||
#if defined(ENABLE_OSR)
|
||||
const auto* wc_impl = web_contents_impl();
|
||||
if (!wc_impl)
|
||||
return;
|
||||
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
||||
wc_impl->GetView());
|
||||
if (osr_wcv)
|
||||
osr_wcv->SetFrameRate(frame_rate);
|
||||
#endif
|
||||
|
@ -1717,12 +1703,9 @@ int WebContents::GetFrameRate() const {
|
|||
return 0;
|
||||
|
||||
#if defined(ENABLE_OSR)
|
||||
const auto* wc_impl = web_contents_impl();
|
||||
if (!wc_impl)
|
||||
return 0;
|
||||
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||
|
||||
const auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
||||
wc_impl->GetView());
|
||||
return osr_wcv ? osr_wcv->GetFrameRate() : 0;
|
||||
#else
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue