 Chromium Code Reviews
 Chromium Code Reviews Issue 2487713002:
  Resolves layering violation in SynchronousCompositorHost creation  (Closed)
    
  
    Issue 2487713002:
  Resolves layering violation in SynchronousCompositorHost creation  (Closed) 
  | Index: content/browser/web_contents/web_contents_view_android.cc | 
| diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc | 
| index e3b9d4ad53631b2a91caa1b4e1aa2bd54264310e..6980ea6bd589428f3d38fb15774a8caf65979a06 100644 | 
| --- a/content/browser/web_contents/web_contents_view_android.cc | 
| +++ b/content/browser/web_contents/web_contents_view_android.cc | 
| @@ -46,6 +46,21 @@ void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) { | 
| results->is_monochrome = display.is_monochrome(); | 
| } | 
| +// static | 
| +void SynchronousCompositor::SetClientForWebContents( | 
| + WebContents* contents, | 
| + SynchronousCompositorClient* client) { | 
| + DCHECK(contents); | 
| + DCHECK(client); | 
| + WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 
| + static_cast<WebContentsImpl*>(contents)->GetView()); | 
| + DCHECK(!wcva->synchronous_compositor_client()); | 
| + wcva->set_synchronous_compositor_client(client); | 
| + RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( | 
| 
boliu
2016/11/08 17:41:05
probably needs null check
 
Jinsuk Kim
2016/11/08 18:05:54
Done.
 | 
| + contents->GetRenderWidgetHostView()); | 
| + rwhv->set_synchronous_compositor_client(client); | 
| +} | 
| + | 
| WebContentsView* CreateWebContentsView( | 
| WebContentsImpl* web_contents, | 
| WebContentsViewDelegate* delegate, | 
| @@ -61,7 +76,8 @@ WebContentsViewAndroid::WebContentsViewAndroid( | 
| WebContentsViewDelegate* delegate) | 
| : web_contents_(web_contents), | 
| content_view_core_(NULL), | 
| - delegate_(delegate) { | 
| + delegate_(delegate), | 
| + synchronous_compositor_client_(nullptr) { | 
| } | 
| WebContentsViewAndroid::~WebContentsViewAndroid() { | 
| @@ -184,7 +200,10 @@ RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForWidget( | 
| // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an | 
| // example of how this is achieved for InterstitialPages. | 
| RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 
| - return new RenderWidgetHostViewAndroid(rwhi, content_view_core_); | 
| + RenderWidgetHostViewAndroid* rwhv = | 
| + new RenderWidgetHostViewAndroid(rwhi, content_view_core_); | 
| + rwhv->set_synchronous_compositor_client(synchronous_compositor_client_); | 
| + return rwhv; | 
| } | 
| RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( |