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

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

Issue 2835203002: Reject CompositorFrames with no render passes when deserializing (Closed)
Patch Set: Fixed Android Webview Created 3 years, 7 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
« no previous file with comments | « content/renderer/android/synchronous_compositor_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (use_in_process_zero_copy_software_draw_) { 285 if (use_in_process_zero_copy_software_draw_) {
286 DCHECK(sk_canvas_for_draw); 286 DCHECK(sk_canvas_for_draw);
287 compositor_frame_sink_->DemandDrawSw(sk_canvas_for_draw); 287 compositor_frame_sink_->DemandDrawSw(sk_canvas_for_draw);
288 } else { 288 } else {
289 DCHECK(!sk_canvas_for_draw); 289 DCHECK(!sk_canvas_for_draw);
290 DoDemandDrawSw(params); 290 DoDemandDrawSw(params);
291 } 291 }
292 } 292 }
293 if (inside_receive_) { 293 if (inside_receive_) {
294 // Did not swap. 294 // Did not swap.
295 SendDemandDrawSwReply(false, cc::CompositorFrame(), reply_message); 295 SendDemandDrawSwReply(base::nullopt, reply_message);
296 inside_receive_ = false; 296 inside_receive_ = false;
297 } 297 }
298 } 298 }
299 299
300 void SynchronousCompositorProxy::DoDemandDrawSw( 300 void SynchronousCompositorProxy::DoDemandDrawSw(
301 const SyncCompositorDemandDrawSwParams& params) { 301 const SyncCompositorDemandDrawSwParams& params) {
302 DCHECK(compositor_frame_sink_); 302 DCHECK(compositor_frame_sink_);
303 DCHECK(software_draw_shm_->zeroed); 303 DCHECK(software_draw_shm_->zeroed);
304 software_draw_shm_->zeroed = false; 304 software_draw_shm_->zeroed = false;
305 305
(...skipping 10 matching lines...) Expand all
316 canvas.clipRect(gfx::RectToSkRect(params.clip)); 316 canvas.clipRect(gfx::RectToSkRect(params.clip));
317 canvas.concat(params.transform.matrix()); 317 canvas.concat(params.transform.matrix());
318 318
319 compositor_frame_sink_->DemandDrawSw(&canvas); 319 compositor_frame_sink_->DemandDrawSw(&canvas);
320 } 320 }
321 321
322 void SynchronousCompositorProxy::SubmitCompositorFrameSw( 322 void SynchronousCompositorProxy::SubmitCompositorFrameSw(
323 cc::CompositorFrame frame) { 323 cc::CompositorFrame frame) {
324 DCHECK(inside_receive_); 324 DCHECK(inside_receive_);
325 DCHECK(software_draw_reply_); 325 DCHECK(software_draw_reply_);
326 SendDemandDrawSwReply(true, std::move(frame), software_draw_reply_); 326 SendDemandDrawSwReply(std::move(frame.metadata), software_draw_reply_);
327 inside_receive_ = false; 327 inside_receive_ = false;
328 } 328 }
329 329
330 void SynchronousCompositorProxy::SendDemandDrawSwReply( 330 void SynchronousCompositorProxy::SendDemandDrawSwReply(
331 bool success, 331 base::Optional<cc::CompositorFrameMetadata> metadata,
332 cc::CompositorFrame frame,
333 IPC::Message* reply_message) { 332 IPC::Message* reply_message) {
334 SyncCompositorCommonRendererParams common_renderer_params; 333 SyncCompositorCommonRendererParams common_renderer_params;
335 PopulateCommonParams(&common_renderer_params); 334 PopulateCommonParams(&common_renderer_params);
336 SyncCompositorMsg_DemandDrawSw::WriteReplyParams( 335 SyncCompositorMsg_DemandDrawSw::WriteReplyParams(
337 reply_message, success, common_renderer_params, frame); 336 reply_message, common_renderer_params, metadata);
338 Send(reply_message); 337 Send(reply_message);
339 } 338 }
340 339
341 void SynchronousCompositorProxy::SubmitCompositorFrame( 340 void SynchronousCompositorProxy::SubmitCompositorFrame(
342 uint32_t compositor_frame_sink_id, 341 uint32_t compositor_frame_sink_id,
343 cc::CompositorFrame frame) { 342 cc::CompositorFrame frame) {
344 // Verify that exactly one of these is true. 343 // Verify that exactly one of these is true.
345 DCHECK(hardware_draw_reply_async_ || hardware_draw_reply_ || 344 DCHECK(hardware_draw_reply_async_ || hardware_draw_reply_ ||
346 software_draw_reply_); 345 software_draw_reply_);
347 DCHECK(!((hardware_draw_reply_ && software_draw_reply_) || 346 DCHECK(!((hardware_draw_reply_ && software_draw_reply_) ||
(...skipping 28 matching lines...) Expand all
376 375
377 void SynchronousCompositorProxy::SetScroll( 376 void SynchronousCompositorProxy::SetScroll(
378 const gfx::ScrollOffset& new_total_scroll_offset) { 377 const gfx::ScrollOffset& new_total_scroll_offset) {
379 if (total_scroll_offset_ == new_total_scroll_offset) 378 if (total_scroll_offset_ == new_total_scroll_offset)
380 return; 379 return;
381 total_scroll_offset_ = new_total_scroll_offset; 380 total_scroll_offset_ = new_total_scroll_offset;
382 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); 381 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_);
383 } 382 }
384 383
385 } // namespace content 384 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698