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 "cc/ipc/cc_param_traits.h" | 10 #include "cc/ipc/cc_param_traits.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 | 128 |
129 void SynchronousCompositorProxy::OnMessageReceived( | 129 void SynchronousCompositorProxy::OnMessageReceived( |
130 const IPC::Message& message) { | 130 const IPC::Message& message) { |
131 if (output_surface_ && output_surface_->OnMessageReceived(message)) | 131 if (output_surface_ && output_surface_->OnMessageReceived(message)) |
132 return; | 132 return; |
133 | 133 |
134 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorProxy, message) | 134 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorProxy, message) |
135 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SynchronizeRendererState, | 135 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SynchronizeRendererState, |
136 PopulateCommonParams) | 136 PopulateCommonParams) |
137 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll) | 137 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll) |
138 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw, | 138 // IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw, |
139 DemandDrawHw) | 139 // DemandDrawHw) |
140 IPC_MESSAGE_HANDLER(CompositorMsg_DemandDrawHw, DemandDrawhw) | |
141 | |
140 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory) | 142 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory) |
141 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory) | 143 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory) |
142 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw, | 144 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw, |
143 DemandDrawSw) | 145 DemandDrawSw) |
144 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZoomBy, SynchronouslyZoomBy) | 146 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZoomBy, SynchronouslyZoomBy) |
145 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetScroll, SetScroll) | 147 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetScroll, SetScroll) |
146 IPC_END_MESSAGE_MAP() | 148 IPC_END_MESSAGE_MAP() |
147 } | 149 } |
148 | 150 |
149 bool SynchronousCompositorProxy::Send(IPC::Message* message) { | 151 bool SynchronousCompositorProxy::Send(IPC::Message* message) { |
(...skipping 12 matching lines...) Expand all Loading... | |
162 base::AutoReset<IPC::Message*> scoped_hardware_draw_reply( | 164 base::AutoReset<IPC::Message*> scoped_hardware_draw_reply( |
163 &hardware_draw_reply_, reply_message); | 165 &hardware_draw_reply_, reply_message); |
164 output_surface_->DemandDrawHw(params.surface_size, params.transform, | 166 output_surface_->DemandDrawHw(params.surface_size, params.transform, |
165 params.viewport, params.clip, | 167 params.viewport, params.clip, |
166 params.viewport_rect_for_tile_priority, | 168 params.viewport_rect_for_tile_priority, |
167 params.transform_for_tile_priority); | 169 params.transform_for_tile_priority); |
168 } | 170 } |
169 | 171 |
170 if (inside_receive_) { | 172 if (inside_receive_) { |
171 // Did not swap. | 173 // Did not swap. |
172 SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message); | 174 // |
175 /* Instead of sending the sync reply, send an async message. */ | |
176 // SendDemandDrawHwReply(cc::CompositorFrame(), 1u, reply_message); | |
177 SyncCompositorCommonRendererParams params; | |
boliu
2016/07/24 17:33:54
this change should be done in SendDemandDrawHwRepl
ojars
2016/07/28 22:53:55
Done.
| |
178 PolutateCommonParams(¶ms); | |
179 Send(new CompositorHostMessage_Frame(routing_id, params, output_surface_id, | |
180 frame)); | |
173 inside_receive_ = false; | 181 inside_receive_ = false; |
174 } | 182 } |
175 } | 183 } |
176 | 184 |
177 void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id, | 185 void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id, |
178 cc::CompositorFrame frame) { | 186 cc::CompositorFrame frame) { |
179 DCHECK(inside_receive_); | 187 DCHECK(inside_receive_); |
180 DCHECK(hardware_draw_reply_); | 188 DCHECK(hardware_draw_reply_); |
181 SendDemandDrawHwReply(std::move(frame), output_surface_id, | 189 SendDemandDrawHwReply(std::move(frame), output_surface_id, |
182 hardware_draw_reply_); | 190 hardware_draw_reply_); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 | 337 |
330 void SynchronousCompositorProxy::SetScroll( | 338 void SynchronousCompositorProxy::SetScroll( |
331 const gfx::ScrollOffset& new_total_scroll_offset) { | 339 const gfx::ScrollOffset& new_total_scroll_offset) { |
332 if (total_scroll_offset_ == new_total_scroll_offset) | 340 if (total_scroll_offset_ == new_total_scroll_offset) |
333 return; | 341 return; |
334 total_scroll_offset_ = new_total_scroll_offset; | 342 total_scroll_offset_ = new_total_scroll_offset; |
335 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); | 343 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); |
336 } | 344 } |
337 | 345 |
338 } // namespace content | 346 } // namespace content |
OLD | NEW |