Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2632)

Unified Diff: android_webview/native/aw_contents.cc

Issue 2036023002: Rewire Android WebView's compositor changed signal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use web_contents_ Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | content/browser/android/synchronous_compositor_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 44738a3edbbff8e4e28ff62fd1072092703f96e1..fb43e96316e4c938901c71a3d0d5ecdb4e18a31e 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -172,7 +172,8 @@ AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID(
}
AwContents::AwContents(std::unique_ptr<WebContents> web_contents)
- : functor_(nullptr),
+ : content::WebContentsObserver(web_contents.get()),
+ functor_(nullptr),
browser_view_renderer_(
this,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)),
@@ -184,6 +185,15 @@ AwContents::AwContents(std::unique_ptr<WebContents> web_contents)
web_contents_->SetUserData(android_webview::kAwContentsUserDataKey,
new AwContentsUserData(this));
browser_view_renderer_.RegisterWithWebContents(web_contents_.get());
+
+ CompositorID compositor_id;
+ if (web_contents_->GetRenderProcessHost() &&
+ web_contents_->GetRenderViewHost()) {
+ compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID();
+ compositor_id.routing_id = web_contents_->GetRoutingID();
+ }
+
+ browser_view_renderer_.SetActiveCompositorID(compositor_id);
render_view_host_ext_.reset(
new AwRenderViewHostExt(this, web_contents_.get()));
@@ -1288,4 +1298,18 @@ void SetShouldDownloadFavicons(JNIEnv* env,
g_should_download_favicons = true;
}
+void AwContents::RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) {
+ DCHECK(new_host);
+
+ int process_id = new_host->GetProcess()->GetID();
+ int routing_id = new_host->GetRoutingID();
+ // At this point, the current RVH may or may not contain a compositor. So
+ // compositor_ may be nullptr, in which case
+ // BrowserViewRenderer::DidInitializeCompositor() callback is time when the
+ // new compositor is constructed.
+ browser_view_renderer_.SetActiveCompositorID(
+ CompositorID(process_id, routing_id));
+}
+
} // namespace android_webview
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | content/browser/android/synchronous_compositor_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698