From df3d94b20d3d5bbc5e852fb68847699e75e25d60 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Fri, 26 Jan 2018 10:30:20 +0100 Subject: [PATCH] Remove web_contents_impl() helper to clarify code and remove unnecessary guard --- atom/browser/api/atom_api_web_contents.cc | 37 ++++++----------------- atom/browser/api/atom_api_web_contents.h | 5 --- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 2b67c8274f8e..c1881db488ef 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -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( - wc_impl->GetView()); + const auto* wc_impl = static_cast(web_contents()); + auto* osr_wcv = static_cast(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( - wc_impl->GetView()); + const auto* wc_impl = static_cast(web_contents()); + auto* osr_wcv = static_cast(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(web_contents()); + auto* osr_wcv = static_cast(wc_impl->GetView()); - const auto* osr_wcv = static_cast( - 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(web_contents()); + auto* osr_wcv = static_cast(wc_impl->GetView()); - auto* osr_wcv = static_cast( - 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(web_contents()); + auto* osr_wcv = static_cast(wc_impl->GetView()); - const auto* osr_wcv = static_cast( - wc_impl->GetView()); return osr_wcv ? osr_wcv->GetFrameRate() : 0; #else return 0; diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index c27d1f77898c..16f23210557c 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -13,7 +13,6 @@ #include "atom/browser/api/trackable_object.h" #include "atom/browser/common_web_contents_delegate.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/public/browser/keyboard_event_processing_result.h" #include "content/public/browser/web_contents.h" @@ -374,10 +373,6 @@ class WebContents : public mate::TrackableObject, return ++request_id_; } - content::WebContentsImpl* web_contents_impl() const { - return static_cast(web_contents()); - } - // Called when we receive a CursorChange message from chromium. void OnCursorChange(const content::WebCursor& cursor);