Index: content/renderer/android/synchronous_compositor_proxy.cc |
diff --git a/content/renderer/android/synchronous_compositor_proxy.cc b/content/renderer/android/synchronous_compositor_proxy.cc |
index ae6a13135e0513262e366ae3b4b190e2126ef289..fc0ca8a8e410e8b00190c8b5466952c2c059e6e7 100644 |
--- a/content/renderer/android/synchronous_compositor_proxy.cc |
+++ b/content/renderer/android/synchronous_compositor_proxy.cc |
@@ -25,12 +25,10 @@ namespace content { |
SynchronousCompositorProxy::SynchronousCompositorProxy( |
int routing_id, |
IPC::Sender* sender, |
- SynchronousCompositorExternalBeginFrameSource* begin_frame_source, |
ui::SynchronousInputHandlerProxy* input_handler_proxy, |
InputHandlerManagerClient::Handler* handler) |
: routing_id_(routing_id), |
sender_(sender), |
- begin_frame_source_(begin_frame_source), |
input_handler_proxy_(input_handler_proxy), |
input_handler_(handler), |
use_in_process_zero_copy_software_draw_( |
@@ -46,18 +44,14 @@ SynchronousCompositorProxy::SynchronousCompositorProxy( |
max_page_scale_factor_(0.f), |
need_animate_scroll_(false), |
need_invalidate_count_(0u), |
- need_begin_frame_(false), |
did_activate_pending_tree_count_(0u) { |
- DCHECK(begin_frame_source_); |
DCHECK(input_handler_proxy_); |
DCHECK(input_handler_); |
- begin_frame_source_->SetClient(this); |
input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings(this); |
} |
SynchronousCompositorProxy::~SynchronousCompositorProxy() { |
SetOutputSurface(nullptr); |
- begin_frame_source_->SetClient(nullptr); |
input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings(nullptr); |
} |
@@ -102,14 +96,6 @@ void SynchronousCompositorProxy::UpdateRootLayerState( |
} |
} |
-void SynchronousCompositorProxy::OnNeedsBeginFramesChange( |
- bool needs_begin_frames) { |
- if (need_begin_frame_ == needs_begin_frames) |
- return; |
- need_begin_frame_ = needs_begin_frames; |
- SendAsyncRendererStateIfNeeded(); |
-} |
- |
void SynchronousCompositorProxy::Invalidate() { |
++need_invalidate_count_; |
SendAsyncRendererStateIfNeeded(); |
@@ -139,7 +125,6 @@ void SynchronousCompositorProxy::PopulateCommonParams( |
params->max_page_scale_factor = max_page_scale_factor_; |
params->need_animate_scroll = need_animate_scroll_; |
params->need_invalidate_count = need_invalidate_count_; |
- params->need_begin_frame = need_begin_frame_; |
params->did_activate_pending_tree_count = did_activate_pending_tree_count_; |
} |
@@ -149,8 +134,9 @@ void SynchronousCompositorProxy::OnMessageReceived( |
return; |
IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorProxy, message) |
+ IPC_MESSAGE_HANDLER(SyncCompositorMsg_SynchronizeRendererState, |
+ PopulateCommonParams) |
IPC_MESSAGE_HANDLER(SyncCompositorMsg_HandleInputEvent, HandleInputEvent) |
- IPC_MESSAGE_HANDLER(SyncCompositorMsg_BeginFrame, BeginFrame) |
IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll) |
IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw, |
DemandDrawHw) |
@@ -158,7 +144,6 @@ void SynchronousCompositorProxy::OnMessageReceived( |
IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory) |
IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw, |
DemandDrawSw) |
- IPC_MESSAGE_HANDLER(SyncCompositorMsg_UpdateState, ProcessCommonParams) |
IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZoomBy, SynchronouslyZoomBy) |
IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetScroll, SetScroll) |
IPC_END_MESSAGE_MAP() |
@@ -169,43 +154,25 @@ bool SynchronousCompositorProxy::Send(IPC::Message* message) { |
} |
void SynchronousCompositorProxy::HandleInputEvent( |
- const SyncCompositorCommonBrowserParams& common_params, |
const blink::WebInputEvent* event, |
SyncCompositorCommonRendererParams* common_renderer_params, |
InputEventAckState* ack) { |
DCHECK(!inside_receive_); |
base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); |
- ProcessCommonParams(common_params); |
DCHECK(!input_handler_->is_null()); |
ui::LatencyInfo latency; |
*ack = input_handler_->Run(routing_id_, event, &latency); |
PopulateCommonParams(common_renderer_params); |
} |
-void SynchronousCompositorProxy::BeginFrame( |
- const SyncCompositorCommonBrowserParams& common_params, |
- const cc::BeginFrameArgs& args, |
- SyncCompositorCommonRendererParams* common_renderer_params) { |
- DCHECK(!inside_receive_); |
- base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); |
- |
- ProcessCommonParams(common_params); |
- if (need_begin_frame_) { |
- begin_frame_source_->BeginFrame(args); |
- } |
- PopulateCommonParams(common_renderer_params); |
-} |
- |
void SynchronousCompositorProxy::DemandDrawHw( |
- const SyncCompositorCommonBrowserParams& common_params, |
const SyncCompositorDemandDrawHwParams& params, |
IPC::Message* reply_message) { |
DCHECK(!inside_receive_); |
DCHECK(reply_message); |
inside_receive_ = true; |
- ProcessCommonParams(common_params); |
if (output_surface_) { |
base::AutoReset<IPC::Message*> scoped_hardware_draw_reply( |
@@ -254,7 +221,6 @@ struct SynchronousCompositorProxy::SharedMemoryWithSize { |
}; |
void SynchronousCompositorProxy::SetSharedMemory( |
- const SyncCompositorCommonBrowserParams& common_params, |
const SyncCompositorSetSharedMemoryParams& params, |
bool* success, |
SyncCompositorCommonRendererParams* common_renderer_params) { |
@@ -262,7 +228,6 @@ void SynchronousCompositorProxy::SetSharedMemory( |
base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); |
*success = false; |
- ProcessCommonParams(common_params); |
if (!base::SharedMemory::IsHandleValid(params.shm_handle)) |
return; |
@@ -276,18 +241,21 @@ void SynchronousCompositorProxy::SetSharedMemory( |
} |
void SynchronousCompositorProxy::ZeroSharedMemory() { |
- DCHECK(!software_draw_shm_->zeroed); |
+ // It is possible to get this called twice, eg if draw is called before |
no sievers
2016/06/03 20:35:50
nits:
'for this to get called'
s/'eg'/'eg.'
duplc
boliu
2016/06/03 21:01:06
Done.
|
+ // the OutputSurface is ready. Just ignore duplciated calls rather than |
+ // inventing a complicated system to avoid it. |
+ if (software_draw_shm_->zeroed) |
+ return; |
+ |
memset(software_draw_shm_->shm.memory(), 0, software_draw_shm_->buffer_size); |
software_draw_shm_->zeroed = true; |
} |
void SynchronousCompositorProxy::DemandDrawSw( |
- const SyncCompositorCommonBrowserParams& common_params, |
const SyncCompositorDemandDrawSwParams& params, |
IPC::Message* reply_message) { |
DCHECK(!inside_receive_); |
inside_receive_ = true; |
- ProcessCommonParams(common_params); |
if (output_surface_) { |
base::AutoReset<IPC::Message*> scoped_software_draw_reply( |
&software_draw_reply_, reply_message); |
@@ -361,9 +329,7 @@ void SynchronousCompositorProxy::SwapBuffers(uint32_t output_surface_id, |
} |
void SynchronousCompositorProxy::OnComputeScroll( |
- const SyncCompositorCommonBrowserParams& common_params, |
base::TimeTicks animation_time) { |
- ProcessCommonParams(common_params); |
if (need_animate_scroll_) { |
need_animate_scroll_ = false; |
input_handler_proxy_->SynchronouslyAnimate(animation_time); |
@@ -371,13 +337,11 @@ void SynchronousCompositorProxy::OnComputeScroll( |
} |
void SynchronousCompositorProxy::SynchronouslyZoomBy( |
- const SyncCompositorCommonBrowserParams& common_params, |
float zoom_delta, |
const gfx::Point& anchor, |
SyncCompositorCommonRendererParams* common_renderer_params) { |
DCHECK(!inside_receive_); |
base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); |
- ProcessCommonParams(common_params); |
input_handler_proxy_->SynchronouslyZoomBy(zoom_delta, anchor); |
PopulateCommonParams(common_renderer_params); |
} |
@@ -398,10 +362,4 @@ void SynchronousCompositorProxy::DidOverscroll( |
did_overscroll_params)); |
} |
-void SynchronousCompositorProxy::ProcessCommonParams( |
- const SyncCompositorCommonBrowserParams& common_params) { |
- begin_frame_source_->SetBeginFrameSourcePaused( |
- common_params.begin_frame_source_paused); |
-} |
- |
} // namespace content |