Commit 6e6d9758 authored by Johann's avatar Johann Committed by Commit Bot

RenderViewImpl: remove FromWebView

Redirect usage in render_view_browsertest.cc through
RenderFrameImpl and render_view(). Despite the comment on
render_view() about it being temporary, this path is much more
commonly used than FromWebView().

Move the definition up a level directly to RenderView. Still
investigating other uses. The goal is to remove anything which
relies on global variables so that RenderViews can be
frozen/throttled independently.

Bug: 1098157
Change-Id: I9fe0c180f305e6d2fa8a302231be8d4529f48192
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2259674
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793531}
parent 12b4f9dc
...@@ -1095,7 +1095,6 @@ TEST_F(RenderViewImplTest, BeginNavigationForWebUI) { ...@@ -1095,7 +1095,6 @@ TEST_F(RenderViewImplTest, BeginNavigationForWebUI) {
network::mojom::WebSandboxFlags::kNone, network::mojom::WebSandboxFlags::kNone,
blink::FeaturePolicyFeatureState(), blink::FeaturePolicyFeatureState(),
blink::AllocateSessionStorageNamespaceId()); blink::AllocateSessionStorageNamespaceId());
RenderViewImpl* new_view = RenderViewImpl::FromWebView(new_web_view);
auto popup_navigation_info = std::make_unique<blink::WebNavigationInfo>(); auto popup_navigation_info = std::make_unique<blink::WebNavigationInfo>();
popup_navigation_info->url_request = std::move(popup_request); popup_navigation_info->url_request = std::move(popup_request);
popup_navigation_info->frame_type = popup_navigation_info->frame_type =
...@@ -1104,7 +1103,9 @@ TEST_F(RenderViewImplTest, BeginNavigationForWebUI) { ...@@ -1104,7 +1103,9 @@ TEST_F(RenderViewImplTest, BeginNavigationForWebUI) {
popup_navigation_info->navigation_policy = popup_navigation_info->navigation_policy =
blink::kWebNavigationPolicyNewForegroundTab; blink::kWebNavigationPolicyNewForegroundTab;
render_thread_->sink().ClearMessages(); render_thread_->sink().ClearMessages();
static_cast<RenderFrameImpl*>(new_view->GetMainRenderFrame()) RenderFrameImpl::FromWebFrame(new_web_view->MainFrame())
->render_view()
->GetMainRenderFrame()
->BeginNavigation(std::move(popup_navigation_info)); ->BeginNavigation(std::move(popup_navigation_info));
EXPECT_TRUE(frame()->IsURLOpened()); EXPECT_TRUE(frame()->IsURLOpened());
} }
......
...@@ -511,18 +511,13 @@ RenderViewImpl::~RenderViewImpl() { ...@@ -511,18 +511,13 @@ RenderViewImpl::~RenderViewImpl() {
} }
/*static*/ /*static*/
RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { RenderView* RenderView::FromWebView(blink::WebView* webview) {
DCHECK(RenderThread::IsMainThread()); DCHECK(RenderThread::IsMainThread());
ViewMap* views = g_view_map.Pointer(); ViewMap* views = g_view_map.Pointer();
auto it = views->find(webview); auto it = views->find(webview);
return it == views->end() ? NULL : it->second; return it == views->end() ? NULL : it->second;
} }
/*static*/
RenderView* RenderView::FromWebView(blink::WebView* webview) {
return RenderViewImpl::FromWebView(webview);
}
/*static*/ /*static*/
RenderViewImpl* RenderViewImpl::FromRoutingID(int32_t routing_id) { RenderViewImpl* RenderViewImpl::FromRoutingID(int32_t routing_id) {
DCHECK(RenderThread::IsMainThread()); DCHECK(RenderThread::IsMainThread());
......
...@@ -124,9 +124,6 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, ...@@ -124,9 +124,6 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
CompositorDependencies* compositor_deps, CompositorDependencies* compositor_deps,
const mojom::CreateViewParams&)); const mojom::CreateViewParams&));
// Returns the RenderViewImpl containing the given WebView.
static RenderViewImpl* FromWebView(blink::WebView* webview);
// Returns the RenderViewImpl for the given routing ID. // Returns the RenderViewImpl for the given routing ID.
static RenderViewImpl* FromRoutingID(int routing_id); static RenderViewImpl* FromRoutingID(int routing_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment