Commit 0aeaef80 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Removing callers of the WebContents::GetRenderProcessHost() method.

WebContents::GetRenderProcessHost is an API that doesn't behave as
expected with out-of-process iframes, as multiple processes can be
associated with a single WebContents.  This CL replaces callers of this
API, so that they go through an equivalent API that explicitly selects
which frame's process is needed.

This CL was started by using an ad-hoc clang-plugin that replaced
existing callsites of WebContents::GetRenderProcessHost() with a call to
something like wc->GetMainFrame()->GetProcess().  This was followed-up
by manually adding an include of render_frame_host.h and git cl format
and git cl lint and then a self-review with small tweaks (e.g. sometimes
using a wc->GetRenderViewHost()->GetProcess() is more appropriate).

This CL was uploaded by git cl split.

R=miu@chromium.org

Bug: 666525
Change-Id: I518a4c7af8783cde82ca6b98796367e4530d94e0
Reviewed-on: https://chromium-review.googlesource.com/689016Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505027}
parent 3e297acb
......@@ -4,12 +4,14 @@
#include "ui/views/controls/webview/webview.h"
#include <string>
#include <utility>
#include "build/build_config.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
......@@ -62,8 +64,9 @@ void WebView::SetWebContents(content::WebContents* replacement) {
observing_render_process_host_->RemoveObserver(this);
observing_render_process_host_ = nullptr;
}
if (web_contents() && web_contents()->GetRenderProcessHost()) {
observing_render_process_host_ = web_contents()->GetRenderProcessHost();
if (web_contents() && web_contents()->GetMainFrame()->GetProcess()) {
observing_render_process_host_ =
web_contents()->GetMainFrame()->GetProcess();
observing_render_process_host_->AddObserver(this);
}
// web_contents() now returns |replacement| from here onwards.
......
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