OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/android/synchronous_compositor_proxy.h" | 5 #include "content/renderer/android/synchronous_compositor_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "content/common/android/sync_compositor_messages.h" | 10 #include "content/common/android/sync_compositor_messages.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 IPC_MESSAGE_HANDLER(SyncCompositorMsg_BeginFrame, BeginFrame) | 167 IPC_MESSAGE_HANDLER(SyncCompositorMsg_BeginFrame, BeginFrame) |
168 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll) | 168 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll) |
169 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw, | 169 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw, |
170 DemandDrawHw) | 170 DemandDrawHw) |
171 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory) | 171 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory) |
172 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory) | 172 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory) |
173 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw, | 173 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw, |
174 DemandDrawSw) | 174 DemandDrawSw) |
175 IPC_MESSAGE_HANDLER(SyncCompositorMsg_UpdateState, ProcessCommonParams) | 175 IPC_MESSAGE_HANDLER(SyncCompositorMsg_UpdateState, ProcessCommonParams) |
176 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZoomBy, SynchronouslyZoomBy) | 176 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZoomBy, SynchronouslyZoomBy) |
| 177 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetScroll, SetScroll) |
177 IPC_END_MESSAGE_MAP() | 178 IPC_END_MESSAGE_MAP() |
178 } | 179 } |
179 | 180 |
180 bool SynchronousCompositorProxy::Send(IPC::Message* message) { | 181 bool SynchronousCompositorProxy::Send(IPC::Message* message) { |
181 return sender_->Send(message); | 182 return sender_->Send(message); |
182 } | 183 } |
183 | 184 |
184 void SynchronousCompositorProxy::HandleInputEvent( | 185 void SynchronousCompositorProxy::HandleInputEvent( |
185 const SyncCompositorCommonBrowserParams& common_params, | 186 const SyncCompositorCommonBrowserParams& common_params, |
186 const blink::WebInputEvent* event, | 187 const blink::WebInputEvent* event, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 float zoom_delta, | 393 float zoom_delta, |
393 const gfx::Point& anchor, | 394 const gfx::Point& anchor, |
394 SyncCompositorCommonRendererParams* common_renderer_params) { | 395 SyncCompositorCommonRendererParams* common_renderer_params) { |
395 DCHECK(!inside_receive_); | 396 DCHECK(!inside_receive_); |
396 base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); | 397 base::AutoReset<bool> scoped_inside_receive(&inside_receive_, true); |
397 ProcessCommonParams(common_params); | 398 ProcessCommonParams(common_params); |
398 input_handler_proxy_->SynchronouslyZoomBy(zoom_delta, anchor); | 399 input_handler_proxy_->SynchronouslyZoomBy(zoom_delta, anchor); |
399 PopulateCommonParams(common_renderer_params); | 400 PopulateCommonParams(common_renderer_params); |
400 } | 401 } |
401 | 402 |
| 403 void SynchronousCompositorProxy::SetScroll( |
| 404 const gfx::ScrollOffset& new_total_scroll_offset) { |
| 405 if (total_scroll_offset_ == new_total_scroll_offset) |
| 406 return; |
| 407 total_scroll_offset_ = new_total_scroll_offset; |
| 408 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); |
| 409 } |
| 410 |
402 void SynchronousCompositorProxy::DidOverscroll( | 411 void SynchronousCompositorProxy::DidOverscroll( |
403 const DidOverscrollParams& did_overscroll_params) { | 412 const DidOverscrollParams& did_overscroll_params) { |
404 SyncCompositorCommonRendererParams params; | 413 SyncCompositorCommonRendererParams params; |
405 PopulateCommonParams(¶ms); | 414 PopulateCommonParams(¶ms); |
406 Send(new SyncCompositorHostMsg_OverScroll(routing_id_, params, | 415 Send(new SyncCompositorHostMsg_OverScroll(routing_id_, params, |
407 did_overscroll_params)); | 416 did_overscroll_params)); |
408 } | 417 } |
409 | 418 |
410 void SynchronousCompositorProxy::ProcessCommonParams( | 419 void SynchronousCompositorProxy::ProcessCommonParams( |
411 const SyncCompositorCommonBrowserParams& common_params) { | 420 const SyncCompositorCommonBrowserParams& common_params) { |
412 if (common_params.update_root_scroll_offset && | |
413 total_scroll_offset_ != common_params.root_scroll_offset) { | |
414 total_scroll_offset_ = common_params.root_scroll_offset; | |
415 input_handler_proxy_->SynchronouslySetRootScrollOffset( | |
416 total_scroll_offset_); | |
417 } | |
418 begin_frame_source_->SetBeginFrameSourcePaused( | 421 begin_frame_source_->SetBeginFrameSourcePaused( |
419 common_params.begin_frame_source_paused); | 422 common_params.begin_frame_source_paused); |
420 } | 423 } |
421 | 424 |
422 } // namespace content | 425 } // namespace content |
OLD | NEW |