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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/browser/aw_browser_context.h" 10 #include "android_webview/browser/aw_browser_context.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( 165 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID(
166 int render_process_id, int render_frame_id) { 166 int render_process_id, int render_frame_id) {
167 AwContents* aw_contents = AwContents::FromWebContents( 167 AwContents* aw_contents = AwContents::FromWebContents(
168 content::WebContents::FromRenderFrameHost( 168 content::WebContents::FromRenderFrameHost(
169 content::RenderFrameHost::FromID(render_process_id, 169 content::RenderFrameHost::FromID(render_process_id,
170 render_frame_id))); 170 render_frame_id)));
171 return aw_contents; 171 return aw_contents;
172 } 172 }
173 173
174 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) 174 AwContents::AwContents(std::unique_ptr<WebContents> web_contents)
175 : functor_(nullptr), 175 : content::WebContentsObserver(web_contents.get()),
176 functor_(nullptr),
176 browser_view_renderer_( 177 browser_view_renderer_(
177 this, 178 this,
178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), 179 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)),
179 web_contents_(std::move(web_contents)), 180 web_contents_(std::move(web_contents)),
180 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { 181 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) {
181 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); 182 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1);
182 icon_helper_.reset(new IconHelper(web_contents_.get())); 183 icon_helper_.reset(new IconHelper(web_contents_.get()));
183 icon_helper_->SetListener(this); 184 icon_helper_->SetListener(this);
184 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, 185 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey,
185 new AwContentsUserData(this)); 186 new AwContentsUserData(this));
186 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); 187 browser_view_renderer_.RegisterWithWebContents(web_contents_.get());
188
189 CompositorID compositor_id;
190 if (web_contents_->GetRenderProcessHost() &&
191 web_contents_->GetRenderViewHost()) {
192 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID();
193 compositor_id.routing_id = web_contents_->GetRoutingID();
194 }
195
196 browser_view_renderer_.SetActiveCompositorID(compositor_id);
187 render_view_host_ext_.reset( 197 render_view_host_ext_.reset(
188 new AwRenderViewHostExt(this, web_contents_.get())); 198 new AwRenderViewHostExt(this, web_contents_.get()));
189 199
190 permission_request_handler_.reset( 200 permission_request_handler_.reset(
191 new PermissionRequestHandler(this, web_contents_.get())); 201 new PermissionRequestHandler(this, web_contents_.get()));
192 202
193 AwAutofillClient* autofill_manager_delegate = 203 AwAutofillClient* autofill_manager_delegate =
194 AwAutofillClient::FromWebContents(web_contents_.get()); 204 AwAutofillClient::FromWebContents(web_contents_.get());
195 if (autofill_manager_delegate) 205 if (autofill_manager_delegate)
196 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); 206 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 JNIEnv* env, 1291 JNIEnv* env,
1282 const JavaParamRef<jobject>& obj) { 1292 const JavaParamRef<jobject>& obj) {
1283 web_contents_->ResumeLoadingCreatedWebContents(); 1293 web_contents_->ResumeLoadingCreatedWebContents();
1284 } 1294 }
1285 1295
1286 void SetShouldDownloadFavicons(JNIEnv* env, 1296 void SetShouldDownloadFavicons(JNIEnv* env,
1287 const JavaParamRef<jclass>& jclazz) { 1297 const JavaParamRef<jclass>& jclazz) {
1288 g_should_download_favicons = true; 1298 g_should_download_favicons = true;
1289 } 1299 }
1290 1300
1301 void AwContents::RenderViewHostChanged(content::RenderViewHost* old_host,
1302 content::RenderViewHost* new_host) {
1303 DCHECK(new_host);
1304
1305 int process_id = new_host->GetProcess()->GetID();
1306 int routing_id = new_host->GetRoutingID();
1307 // At this point, the current RVH may or may not contain a compositor. So
1308 // compositor_ may be nullptr, in which case
1309 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the
1310 // new compositor is constructed.
1311 browser_view_renderer_.SetActiveCompositorID(
1312 CompositorID(process_id, routing_id));
1313 }
1314
1291 } // namespace android_webview 1315 } // namespace android_webview
OLDNEW
« 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