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/browser/android/synchronous_compositor_host.h" | 5 #include "content/browser/android/synchronous_compositor_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 client_->DidInitializeCompositor(this, process_id_, routing_id_); | 81 client_->DidInitializeCompositor(this, process_id_, routing_id_); |
82 } | 82 } |
83 | 83 |
84 SynchronousCompositorHost::~SynchronousCompositorHost() { | 84 SynchronousCompositorHost::~SynchronousCompositorHost() { |
85 client_->DidDestroyCompositor(this, process_id_, routing_id_); | 85 client_->DidDestroyCompositor(this, process_id_, routing_id_); |
86 } | 86 } |
87 | 87 |
88 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { | 88 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { |
89 bool handled = true; | 89 bool handled = true; |
90 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) | 90 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) |
91 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OutputSurfaceCreated, | 91 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_CompositorFrameSinkCreated, |
92 OutputSurfaceCreated) | 92 CompositorFrameSinkCreated) |
93 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) | 93 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) |
94 IPC_MESSAGE_HANDLER_GENERIC(SyncCompositorHostMsg_ReturnFrame, | 94 IPC_MESSAGE_HANDLER_GENERIC(SyncCompositorHostMsg_ReturnFrame, |
95 DemandDrawHwReceiveFrame(message)) | 95 DemandDrawHwReceiveFrame(message)) |
96 IPC_MESSAGE_UNHANDLED(handled = false) | 96 IPC_MESSAGE_UNHANDLED(handled = false) |
97 IPC_END_MESSAGE_MAP() | 97 IPC_END_MESSAGE_MAP() |
98 return handled; | 98 return handled; |
99 } | 99 } |
100 | 100 |
101 void SynchronousCompositorHost::DemandDrawHwAsync( | 101 void SynchronousCompositorHost::DemandDrawHwAsync( |
102 const gfx::Size& viewport_size, | 102 const gfx::Size& viewport_size, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 client_->DidOverscroll(this, over_scroll_params.accumulated_overscroll, | 372 client_->DidOverscroll(this, over_scroll_params.accumulated_overscroll, |
373 over_scroll_params.latest_overscroll_delta, | 373 over_scroll_params.latest_overscroll_delta, |
374 over_scroll_params.current_fling_velocity); | 374 over_scroll_params.current_fling_velocity); |
375 } | 375 } |
376 | 376 |
377 void SynchronousCompositorHost::DidSendBeginFrame( | 377 void SynchronousCompositorHost::DidSendBeginFrame( |
378 ui::WindowAndroid* window_android) { | 378 ui::WindowAndroid* window_android) { |
379 rph_observer_->SyncStateAfterVSync(window_android, this); | 379 rph_observer_->SyncStateAfterVSync(window_android, this); |
380 } | 380 } |
381 | 381 |
382 void SynchronousCompositorHost::OutputSurfaceCreated() { | 382 void SynchronousCompositorHost::CompositorFrameSinkCreated() { |
383 // New output surface is not aware of state from Browser side. So need to | 383 // New CompositorFrameSink is not aware of state from Browser side. So need to |
384 // re-send all browser side state here. | 384 // re-send all browser side state here. |
385 sender_->Send( | 385 sender_->Send( |
386 new SyncCompositorMsg_SetMemoryPolicy(routing_id_, bytes_limit_)); | 386 new SyncCompositorMsg_SetMemoryPolicy(routing_id_, bytes_limit_)); |
387 } | 387 } |
388 | 388 |
389 void SynchronousCompositorHost::ProcessCommonParams( | 389 void SynchronousCompositorHost::ProcessCommonParams( |
390 const SyncCompositorCommonRendererParams& params) { | 390 const SyncCompositorCommonRendererParams& params) { |
391 // Ignore if |renderer_param_version_| is newer than |params.version|. This | 391 // Ignore if |renderer_param_version_| is newer than |params.version|. This |
392 // comparison takes into account when the unsigned int wraps. | 392 // comparison takes into account when the unsigned int wraps. |
393 if ((renderer_param_version_ - params.version) < 0x80000000) { | 393 if ((renderer_param_version_ - params.version) < 0x80000000) { |
(...skipping 20 matching lines...) Expand all Loading... |
414 if (params.page_scale_factor) { | 414 if (params.page_scale_factor) { |
415 client_->UpdateRootLayerState( | 415 client_->UpdateRootLayerState( |
416 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), | 416 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), |
417 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), | 417 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), |
418 params.scrollable_size, params.page_scale_factor, | 418 params.scrollable_size, params.page_scale_factor, |
419 params.min_page_scale_factor, params.max_page_scale_factor); | 419 params.min_page_scale_factor, params.max_page_scale_factor); |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 } // namespace content | 423 } // namespace content |
OLD | NEW |