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;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_OSR)
|
#if defined(ENABLE_OSR)
|
||||||
const auto* wc_impl = web_contents_impl();
|
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||||
if (!wc_impl)
|
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||||
return;
|
|
||||||
|
|
||||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
|
||||||
wc_impl->GetView());
|
|
||||||
if (osr_wcv)
|
if (osr_wcv)
|
||||||
osr_wcv->SetPainting(true);
|
osr_wcv->SetPainting(true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1668,12 +1664,8 @@ void WebContents::StopPainting() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_OSR)
|
#if defined(ENABLE_OSR)
|
||||||
const auto* wc_impl = web_contents_impl();
|
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||||
if (!wc_impl)
|
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||||
return;
|
|
||||||
|
|
||||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
|
||||||
wc_impl->GetView());
|
|
||||||
if (osr_wcv)
|
if (osr_wcv)
|
||||||
osr_wcv->SetPainting(false);
|
osr_wcv->SetPainting(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1684,12 +1676,9 @@ bool WebContents::IsPainting() const {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(ENABLE_OSR)
|
#if defined(ENABLE_OSR)
|
||||||
const auto* wc_impl = web_contents_impl();
|
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||||
if (!wc_impl)
|
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||||
return false;
|
|
||||||
|
|
||||||
const auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
|
||||||
wc_impl->GetView());
|
|
||||||
return osr_wcv && osr_wcv->IsPainting();
|
return osr_wcv && osr_wcv->IsPainting();
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1701,12 +1690,9 @@ void WebContents::SetFrameRate(int frame_rate) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_OSR)
|
#if defined(ENABLE_OSR)
|
||||||
const auto* wc_impl = web_contents_impl();
|
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||||
if (!wc_impl)
|
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||||
return;
|
|
||||||
|
|
||||||
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
|
||||||
wc_impl->GetView());
|
|
||||||
if (osr_wcv)
|
if (osr_wcv)
|
||||||
osr_wcv->SetFrameRate(frame_rate);
|
osr_wcv->SetFrameRate(frame_rate);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1717,12 +1703,9 @@ int WebContents::GetFrameRate() const {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(ENABLE_OSR)
|
#if defined(ENABLE_OSR)
|
||||||
const auto* wc_impl = web_contents_impl();
|
const auto* wc_impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||||
if (!wc_impl)
|
auto* osr_wcv = static_cast<OffScreenWebContentsView*>(wc_impl->GetView());
|
||||||
return 0;
|
|
||||||
|
|
||||||
const auto* osr_wcv = static_cast<OffScreenWebContentsView*>(
|
|
||||||
wc_impl->GetView());
|
|
||||||
return osr_wcv ? osr_wcv->GetFrameRate() : 0;
|
return osr_wcv ? osr_wcv->GetFrameRate() : 0;
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "atom/browser/api/trackable_object.h"
|
#include "atom/browser/api/trackable_object.h"
|
||||||
#include "atom/browser/common_web_contents_delegate.h"
|
#include "atom/browser/common_web_contents_delegate.h"
|
||||||
#include "atom/browser/ui/autofill_popup.h"
|
#include "atom/browser/ui/autofill_popup.h"
|
||||||
#include "content/browser/web_contents/web_contents_impl.h"
|
|
||||||
#include "content/common/cursors/webcursor.h"
|
#include "content/common/cursors/webcursor.h"
|
||||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
@ -374,10 +373,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
return ++request_id_;
|
return ++request_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebContentsImpl* web_contents_impl() const {
|
|
||||||
return static_cast<content::WebContentsImpl*>(web_contents());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when we receive a CursorChange message from chromium.
|
// Called when we receive a CursorChange message from chromium.
|
||||||
void OnCursorChange(const content::WebCursor& cursor);
|
void OnCursorChange(const content::WebCursor& cursor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue