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

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

Issue 2882303002: Factor FrameData out of RendererCompositorFrameSink (Closed)
Patch Set: c 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/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 renderer_compositor_frame_sink_ = std::move(client); 2539 renderer_compositor_frame_sink_ = std::move(client);
2540 } 2540 }
2541 2541
2542 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { 2542 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) {
2543 OnSetNeedsBeginFrames(needs_begin_frame); 2543 OnSetNeedsBeginFrames(needs_begin_frame);
2544 } 2544 }
2545 2545
2546 void RenderWidgetHostImpl::SubmitCompositorFrame( 2546 void RenderWidgetHostImpl::SubmitCompositorFrame(
2547 const cc::LocalSurfaceId& local_surface_id, 2547 const cc::LocalSurfaceId& local_surface_id,
2548 cc::CompositorFrame frame) { 2548 cc::CompositorFrame frame) {
2549 // The renderer must allocate a new LocalSurfaceId if frame size or device 2549 auto new_surface_properties =
2550 // scale factor changes. 2550 RenderWidgetSurfaceProperties::FromCompositorFrame(frame);
2551 float device_scale_factor = frame.metadata.device_scale_factor; 2551
2552 const gfx::Size& frame_size =
2553 frame.render_pass_list.back()->output_rect.size();
2554 if (local_surface_id == last_local_surface_id_ && 2552 if (local_surface_id == last_local_surface_id_ &&
2555 (frame_size != last_frame_size_ || 2553 new_surface_properties != last_surface_properties_) {
2556 device_scale_factor != last_device_scale_factor_)) { 2554 bad_message::ReceivedBadMessage(
2557 DLOG(ERROR) << "Renderer submitted frame of wrong size to its surface." 2555 GetProcess(), bad_message::RWH_SURFACE_INVARIANTS_VIOLATION);
2558 << " Expected: size=" << last_frame_size_.ToString()
2559 << ",scale=" << last_device_scale_factor_
2560 << " Received: size=" << frame_size.ToString()
2561 << ",scale=" << device_scale_factor;
2562 return; 2556 return;
2563 } 2557 }
2564 2558
2565 uint32_t frame_token = frame.metadata.frame_token;
2566
2567 last_local_surface_id_ = local_surface_id; 2559 last_local_surface_id_ = local_surface_id;
2568 last_frame_size_ = frame_size; 2560 last_surface_properties_ = new_surface_properties;
2569 last_device_scale_factor_ = device_scale_factor;
2570 2561
2571 last_received_content_source_id_ = frame.metadata.content_source_id; 2562 last_received_content_source_id_ = frame.metadata.content_source_id;
2563 uint32_t frame_token = frame.metadata.frame_token;
2572 2564
2573 // |has_damage| is not transmitted. 2565 // |has_damage| is not transmitted.
2574 frame.metadata.begin_frame_ack.has_damage = true; 2566 frame.metadata.begin_frame_ack.has_damage = true;
2575 2567
2576 last_frame_metadata_ = frame.metadata.Clone(); 2568 last_frame_metadata_ = frame.metadata.Clone();
2577 2569
2578 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); 2570 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info);
2579 2571
2580 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); 2572 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata);
2581 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); 2573 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 RenderProcessHost* rph = GetProcess(); 2625 RenderProcessHost* rph = GetProcess();
2634 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); 2626 for (std::vector<IPC::Message>::const_iterator i = messages.begin();
2635 i != messages.end(); ++i) { 2627 i != messages.end(); ++i) {
2636 rph->OnMessageReceived(*i); 2628 rph->OnMessageReceived(*i);
2637 if (i->dispatch_error()) 2629 if (i->dispatch_error())
2638 rph->OnBadMessageReceived(*i); 2630 rph->OnBadMessageReceived(*i);
2639 } 2631 }
2640 } 2632 }
2641 2633
2642 } // namespace content 2634 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698