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

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

Issue 1769913003: sync compositor: Add output_surface_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit in test Created 4 years, 9 months 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 "content/common/android/sync_compositor_messages.h" 10 #include "content/common/android/sync_compositor_messages.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 &hardware_draw_reply_, reply_message); 211 &hardware_draw_reply_, reply_message);
212 output_surface_->DemandDrawHw(params.surface_size, params.transform, 212 output_surface_->DemandDrawHw(params.surface_size, params.transform,
213 params.viewport, params.clip, 213 params.viewport, params.clip,
214 params.viewport_rect_for_tile_priority, 214 params.viewport_rect_for_tile_priority,
215 params.transform_for_tile_priority); 215 params.transform_for_tile_priority);
216 } 216 }
217 217
218 if (inside_receive_) { 218 if (inside_receive_) {
219 // Did not swap. 219 // Did not swap.
220 cc::CompositorFrame empty_frame; 220 cc::CompositorFrame empty_frame;
221 SendDemandDrawHwReply(&empty_frame, reply_message); 221 SendDemandDrawHwReply(&empty_frame, 0u, reply_message);
222 inside_receive_ = false; 222 inside_receive_ = false;
223 } else { 223 } else {
224 DeliverMessages(); 224 DeliverMessages();
225 } 225 }
226 } 226 }
227 227
228 void SynchronousCompositorProxy::SwapBuffersHw(cc::CompositorFrame* frame) { 228 void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id,
229 cc::CompositorFrame* frame) {
229 DCHECK(inside_receive_); 230 DCHECK(inside_receive_);
230 DCHECK(hardware_draw_reply_); 231 DCHECK(hardware_draw_reply_);
231 DCHECK(frame); 232 DCHECK(frame);
232 SendDemandDrawHwReply(frame, hardware_draw_reply_); 233 SendDemandDrawHwReply(frame, output_surface_id, hardware_draw_reply_);
233 inside_receive_ = false; 234 inside_receive_ = false;
234 } 235 }
235 236
236 void SynchronousCompositorProxy::SendDemandDrawHwReply( 237 void SynchronousCompositorProxy::SendDemandDrawHwReply(
237 cc::CompositorFrame* frame, 238 cc::CompositorFrame* frame,
239 uint32_t output_surface_id,
238 IPC::Message* reply_message) { 240 IPC::Message* reply_message) {
239 SyncCompositorCommonRendererParams common_renderer_params; 241 SyncCompositorCommonRendererParams common_renderer_params;
240 PopulateCommonParams(&common_renderer_params); 242 PopulateCommonParams(&common_renderer_params);
241 // Not using WriteParams because cc::CompositorFrame is not copy-able. 243 SyncCompositorMsg_DemandDrawHw::WriteReplyParams(
242 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write( 244 reply_message, common_renderer_params, output_surface_id, *frame);
243 reply_message, common_renderer_params);
244 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame);
245 Send(reply_message); 245 Send(reply_message);
246 } 246 }
247 247
248 struct SynchronousCompositorProxy::SharedMemoryWithSize { 248 struct SynchronousCompositorProxy::SharedMemoryWithSize {
249 base::SharedMemory shm; 249 base::SharedMemory shm;
250 const size_t buffer_size; 250 const size_t buffer_size;
251 bool zeroed; 251 bool zeroed;
252 252
253 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size) 253 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size)
254 : shm(shm_handle, false), buffer_size(buffer_size), zeroed(true) {} 254 : shm(shm_handle, false), buffer_size(buffer_size), zeroed(true) {}
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SendDemandDrawSwReply(true, frame, software_draw_reply_); 351 SendDemandDrawSwReply(true, frame, software_draw_reply_);
352 inside_receive_ = false; 352 inside_receive_ = false;
353 } 353 }
354 354
355 void SynchronousCompositorProxy::SendDemandDrawSwReply( 355 void SynchronousCompositorProxy::SendDemandDrawSwReply(
356 bool success, 356 bool success,
357 cc::CompositorFrame* frame, 357 cc::CompositorFrame* frame,
358 IPC::Message* reply_message) { 358 IPC::Message* reply_message) {
359 SyncCompositorCommonRendererParams common_renderer_params; 359 SyncCompositorCommonRendererParams common_renderer_params;
360 PopulateCommonParams(&common_renderer_params); 360 PopulateCommonParams(&common_renderer_params);
361 // Not using WriteParams because cc::CompositorFrame is not copy-able. 361 SyncCompositorMsg_DemandDrawSw::WriteReplyParams(
362 IPC::ParamTraits<bool>::Write(reply_message, success); 362 reply_message, success, common_renderer_params, *frame);
363 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write(
364 reply_message, common_renderer_params);
365 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame);
366 Send(reply_message); 363 Send(reply_message);
367 } 364 }
368 365
369 void SynchronousCompositorProxy::SwapBuffers(cc::CompositorFrame* frame) { 366 void SynchronousCompositorProxy::SwapBuffers(uint32_t output_surface_id,
367 cc::CompositorFrame* frame) {
370 DCHECK(hardware_draw_reply_ || software_draw_reply_); 368 DCHECK(hardware_draw_reply_ || software_draw_reply_);
371 DCHECK(!(hardware_draw_reply_ && software_draw_reply_)); 369 DCHECK(!(hardware_draw_reply_ && software_draw_reply_));
372 if (hardware_draw_reply_) { 370 if (hardware_draw_reply_) {
373 SwapBuffersHw(frame); 371 SwapBuffersHw(output_surface_id, frame);
374 } else if (software_draw_reply_) { 372 } else if (software_draw_reply_) {
375 SwapBuffersSw(frame); 373 SwapBuffersSw(frame);
376 } 374 }
377 } 375 }
378 376
379 void SynchronousCompositorProxy::OnComputeScroll( 377 void SynchronousCompositorProxy::OnComputeScroll(
380 const SyncCompositorCommonBrowserParams& common_params, 378 const SyncCompositorCommonBrowserParams& common_params,
381 base::TimeTicks animation_time) { 379 base::TimeTicks animation_time) {
382 ProcessCommonParams(common_params); 380 ProcessCommonParams(common_params);
383 if (need_animate_scroll_) { 381 if (need_animate_scroll_) {
(...skipping 18 matching lines...) Expand all
402 } 400 }
403 if (common_params.update_root_scroll_offset && 401 if (common_params.update_root_scroll_offset &&
404 total_scroll_offset_ != common_params.root_scroll_offset) { 402 total_scroll_offset_ != common_params.root_scroll_offset) {
405 total_scroll_offset_ = common_params.root_scroll_offset; 403 total_scroll_offset_ = common_params.root_scroll_offset;
406 input_handler_proxy_->SynchronouslySetRootScrollOffset( 404 input_handler_proxy_->SynchronouslySetRootScrollOffset(
407 total_scroll_offset_); 405 total_scroll_offset_);
408 } 406 }
409 begin_frame_source_->SetBeginFrameSourcePaused( 407 begin_frame_source_->SetBeginFrameSourcePaused(
410 common_params.begin_frame_source_paused); 408 common_params.begin_frame_source_paused);
411 if (!common_params.ack.resources.empty()) { 409 if (!common_params.ack.resources.empty()) {
412 output_surface_->ReturnResources(common_params.ack); 410 output_surface_->ReturnResources(
411 common_params.output_surface_id_for_returned_resources,
412 common_params.ack);
413 } 413 }
414 } 414 }
415 415
416 } // namespace content 416 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_proxy.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698