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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 1385543003: Have RenderWidgetHostViewAndroid own sync compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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 | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index c182e2982a386ead45fdc64039a74409dc498795..4adc51fd372b2aa902c447eeca1e4d0ac98e2ef7 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -1176,6 +1176,11 @@ void RenderWidgetHostViewAndroid::RetainFrame(
last_frame_info_.reset(new LastFrameInfo(output_surface_id, frame.Pass()));
}
+SynchronousCompositorImpl*
+RenderWidgetHostViewAndroid::GetSynchronousCompositorImpl() {
+ return sync_compositor_.get();
+}
+
void RenderWidgetHostViewAndroid::SynchronousFrameMetadata(
const cc::CompositorFrameMetadata& frame_metadata) {
if (!content_view_core_)
@@ -1281,10 +1286,7 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents(
int output_width = output_size_in_pixel.width();
int output_height = output_size_in_pixel.height();
- SynchronousCompositor* compositor =
- SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(),
- host_->GetRoutingID());
- if (!compositor) {
+ if (!sync_compositor_) {
callback.Run(SkBitmap(), READBACK_FAILED);
return;
}
@@ -1298,7 +1300,7 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents(
canvas.scale(
(float)output_width / (float)input_size_in_pixel.width(),
(float)output_height / (float)input_size_in_pixel.height());
- compositor->DemandDrawSw(&canvas);
+ sync_compositor_->DemandDrawSw(&canvas);
callback.Run(bitmap, READBACK_SUCCESS);
}
@@ -1482,16 +1484,12 @@ void RenderWidgetHostViewAndroid::SendBeginFrame(base::TimeTicks frame_time,
host_->GetRoutingID(),
cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline,
vsync_period, cc::BeginFrameArgs::NORMAL)));
- } else {
- SynchronousCompositorImpl* compositor = SynchronousCompositorImpl::FromID(
- host_->GetProcess()->GetID(), host_->GetRoutingID());
- if (compositor) {
- // The synchronous compositor synchronously does it's work in this call.
- // It does not use a deadline.
- compositor->BeginFrame(cc::BeginFrameArgs::Create(
- BEGINFRAME_FROM_HERE, frame_time, base::TimeTicks(), vsync_period,
- cc::BeginFrameArgs::NORMAL));
- }
+ } else if (sync_compositor_.get()) {
+ // The synchronous compositor synchronously does it's work in this call.
+ // It does not use a deadline.
+ sync_compositor_->BeginFrame(cc::BeginFrameArgs::Create(
+ BEGINFRAME_FROM_HERE, frame_time, base::TimeTicks(), vsync_period,
+ cc::BeginFrameArgs::NORMAL));
}
}
@@ -1609,11 +1607,8 @@ InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent(
shim->Send(new GpuMsg_WakeUpGpu);
}
- SynchronousCompositorImpl* compositor =
- SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(),
- host_->GetRoutingID());
- if (compositor)
- return compositor->HandleInputEvent(input_event);
+ if (sync_compositor_.get())
+ return sync_compositor_->HandleInputEvent(input_event);
return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
}
@@ -1772,9 +1767,10 @@ void RenderWidgetHostViewAndroid::SetContentViewCore(
}
AttachLayers();
-
- if (!content_view_core_)
+ if (!content_view_core_) {
+ sync_compositor_.reset();
jdduke (slow) 2015/10/05 19:56:03 What about the case where we transition from one v
boliu 2015/10/06 00:05:30 Assume for now there will be only one RenderView p
boliu 2015/10/06 01:28:04 Let me re-phrase that a bit better, now that I'm n
return;
+ }
if (is_showing_)
StartObservingRootWindow();
@@ -1789,6 +1785,11 @@ void RenderWidgetHostViewAndroid::SetContentViewCore(
content_view_core_window_android_->GetCompositor()) {
overscroll_controller_ = CreateOverscrollController(content_view_core_);
}
+
+ if (!using_browser_compositor_ && !sync_compositor_.get()) {
+ sync_compositor_ = SynchronousCompositorImpl::Create(
+ this, content_view_core_->GetWebContents());
+ }
}
void RenderWidgetHostViewAndroid::RunAckCallbacks(
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698