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

Side by Side Diff: content/renderer/android/synchronous_compositor_proxy.cc

Issue 2458743002: Switching to base::Optional<CompositorFrame> in Android's synchronous compositor IPC messages (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 &hardware_draw_reply_, reply_message); 181 &hardware_draw_reply_, reply_message);
182 compositor_frame_sink_->DemandDrawHw( 182 compositor_frame_sink_->DemandDrawHw(
183 params.viewport_size, params.viewport_rect_for_tile_priority, 183 params.viewport_size, params.viewport_rect_for_tile_priority,
184 params.transform_for_tile_priority); 184 params.transform_for_tile_priority);
185 } 185 }
186 } 186 }
187 187
188 if (inside_receive_) { 188 if (inside_receive_) {
189 // Did not swap. 189 // Did not swap.
190 if (!reply_message) { 190 if (!reply_message) {
191 SendDemandDrawHwReplyAsync(cc::CompositorFrame(), 0u); 191 SendDemandDrawHwReplyAsync(cc::CompositorFrame(), 0u, false);
192 } else { 192 } else {
193 SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message); 193 SendDemandDrawHwReply(cc::CompositorFrame(), 0u, false, reply_message);
194 } 194 }
195 inside_receive_ = false; 195 inside_receive_ = false;
196 } 196 }
197 } 197 }
198 198
199 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( 199 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync(
200 uint32_t compositor_frame_sink_id, 200 uint32_t compositor_frame_sink_id,
201 cc::CompositorFrame frame) { 201 cc::CompositorFrame frame) {
202 DCHECK(inside_receive_); 202 DCHECK(inside_receive_);
203 DCHECK(hardware_draw_reply_async_); 203 DCHECK(hardware_draw_reply_async_);
204 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); 204 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id, true);
205 inside_receive_ = false; 205 inside_receive_ = false;
206 } 206 }
207 207
208 void SynchronousCompositorProxy::SubmitCompositorFrameHw( 208 void SynchronousCompositorProxy::SubmitCompositorFrameHw(
209 uint32_t compositor_frame_sink_id, 209 uint32_t compositor_frame_sink_id,
210 cc::CompositorFrame frame) { 210 cc::CompositorFrame frame) {
211 DCHECK(inside_receive_); 211 DCHECK(inside_receive_);
212 DCHECK(hardware_draw_reply_); 212 DCHECK(hardware_draw_reply_);
213 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, 213 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, true,
214 hardware_draw_reply_); 214 hardware_draw_reply_);
215 inside_receive_ = false; 215 inside_receive_ = false;
216 } 216 }
217 217
218 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( 218 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync(
219 cc::CompositorFrame frame, 219 cc::CompositorFrame frame,
220 uint32_t compositor_frame_sink_id) { 220 uint32_t compositor_frame_sink_id,
221 Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, 221 bool has_swapped) {
222 compositor_frame_sink_id, frame)); 222 Send(new SyncCompositorHostMsg_ReturnFrame(
223 routing_id_, compositor_frame_sink_id, frame, has_swapped));
223 } 224 }
224 225
225 void SynchronousCompositorProxy::SendDemandDrawHwReply( 226 void SynchronousCompositorProxy::SendDemandDrawHwReply(
226 cc::CompositorFrame frame, 227 cc::CompositorFrame frame,
227 uint32_t compositor_frame_sink_id, 228 uint32_t compositor_frame_sink_id,
229 bool has_swapped,
228 IPC::Message* reply_message) { 230 IPC::Message* reply_message) {
229 SyncCompositorCommonRendererParams common_renderer_params; 231 SyncCompositorCommonRendererParams common_renderer_params;
230 PopulateCommonParams(&common_renderer_params); 232 PopulateCommonParams(&common_renderer_params);
231 SyncCompositorMsg_DemandDrawHw::WriteReplyParams( 233 SyncCompositorMsg_DemandDrawHw::WriteReplyParams(
232 reply_message, common_renderer_params, compositor_frame_sink_id, frame); 234 reply_message, common_renderer_params, compositor_frame_sink_id, frame,
235 has_swapped);
233 Send(reply_message); 236 Send(reply_message);
234 } 237 }
235 238
236 struct SynchronousCompositorProxy::SharedMemoryWithSize { 239 struct SynchronousCompositorProxy::SharedMemoryWithSize {
237 base::SharedMemory shm; 240 base::SharedMemory shm;
238 const size_t buffer_size; 241 const size_t buffer_size;
239 bool zeroed; 242 bool zeroed;
240 243
241 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size) 244 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size)
242 : shm(shm_handle, false), buffer_size(buffer_size), zeroed(true) {} 245 : shm(shm_handle, false), buffer_size(buffer_size), zeroed(true) {}
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 379
377 void SynchronousCompositorProxy::SetScroll( 380 void SynchronousCompositorProxy::SetScroll(
378 const gfx::ScrollOffset& new_total_scroll_offset) { 381 const gfx::ScrollOffset& new_total_scroll_offset) {
379 if (total_scroll_offset_ == new_total_scroll_offset) 382 if (total_scroll_offset_ == new_total_scroll_offset)
380 return; 383 return;
381 total_scroll_offset_ = new_total_scroll_offset; 384 total_scroll_offset_ = new_total_scroll_offset;
382 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); 385 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_);
383 } 386 }
384 387
385 } // namespace content 388 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698