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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2835203002: Reject CompositorFrames with no render passes when deserializing (Closed)
Patch Set: Fixed Android Webview Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 renderer_compositor_frame_sink_ = std::move(client); 2624 renderer_compositor_frame_sink_ = std::move(client);
2625 } 2625 }
2626 2626
2627 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { 2627 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) {
2628 OnSetNeedsBeginFrames(needs_begin_frame); 2628 OnSetNeedsBeginFrames(needs_begin_frame);
2629 } 2629 }
2630 2630
2631 void RenderWidgetHostImpl::SubmitCompositorFrame( 2631 void RenderWidgetHostImpl::SubmitCompositorFrame(
2632 const cc::LocalSurfaceId& local_surface_id, 2632 const cc::LocalSurfaceId& local_surface_id,
2633 cc::CompositorFrame frame) { 2633 cc::CompositorFrame frame) {
2634 // The renderer should not send empty frames.
2635 if (frame.render_pass_list.empty()) {
2636 DLOG(ERROR) << "Renderer sent an empty frame.";
2637 return;
2638 }
2639
2640 // The renderer must allocate a new LocalSurfaceId if frame size or device 2634 // The renderer must allocate a new LocalSurfaceId if frame size or device
2641 // scale factor changes. 2635 // scale factor changes.
2642 float device_scale_factor = frame.metadata.device_scale_factor; 2636 float device_scale_factor = frame.metadata.device_scale_factor;
2643 const gfx::Size& frame_size = 2637 const gfx::Size& frame_size =
2644 frame.render_pass_list.back()->output_rect.size(); 2638 frame.render_pass_list.back()->output_rect.size();
2645 if (local_surface_id == last_local_surface_id_ && 2639 if (local_surface_id == last_local_surface_id_ &&
2646 (frame_size != last_frame_size_ || 2640 (frame_size != last_frame_size_ ||
2647 device_scale_factor != last_device_scale_factor_)) { 2641 device_scale_factor != last_device_scale_factor_)) {
2648 DLOG(ERROR) << "Renderer submitted frame of wrong size to its surface." 2642 DLOG(ERROR) << "Renderer submitted frame of wrong size to its surface."
2649 << " Expected: size=" << last_frame_size_.ToString() 2643 << " Expected: size=" << last_frame_size_.ToString()
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 RenderProcessHost* rph = GetProcess(); 2731 RenderProcessHost* rph = GetProcess();
2738 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); 2732 for (std::vector<IPC::Message>::const_iterator i = messages.begin();
2739 i != messages.end(); ++i) { 2733 i != messages.end(); ++i) {
2740 rph->OnMessageReceived(*i); 2734 rph->OnMessageReceived(*i);
2741 if (i->dispatch_error()) 2735 if (i->dispatch_error())
2742 rph->OnBadMessageReceived(*i); 2736 rph->OnBadMessageReceived(*i);
2743 } 2737 }
2744 } 2738 }
2745 2739
2746 } // namespace content 2740 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/synchronous_compositor_host.cc ('k') | content/common/android/sync_compositor_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698