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

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

Issue 2780373002: Use observer pattern instead of sniffing SwapCompositorFrame IPC (Closed)
Patch Set: Don't send metadata 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 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 (frame_size != last_frame_size_ || 2602 (frame_size != last_frame_size_ ||
2603 device_scale_factor != last_device_scale_factor_)) { 2603 device_scale_factor != last_device_scale_factor_)) {
2604 DLOG(ERROR) << "Renderer submitted frame of wrong size to its surface." 2604 DLOG(ERROR) << "Renderer submitted frame of wrong size to its surface."
2605 << " Expected: size=" << last_frame_size_.ToString() 2605 << " Expected: size=" << last_frame_size_.ToString()
2606 << ",scale=" << last_device_scale_factor_ 2606 << ",scale=" << last_device_scale_factor_
2607 << " Received: size=" << frame_size.ToString() 2607 << " Received: size=" << frame_size.ToString()
2608 << ",scale=" << device_scale_factor; 2608 << ",scale=" << device_scale_factor;
2609 return; 2609 return;
2610 } 2610 }
2611 2611
2612 last_frame_metadata_ = frame.metadata.Clone();
piman 2017/04/04 17:34:46 Could we move this to after l.2636? 2 reasons: 1-
Saman Sami 2017/04/04 17:49:54 Good point.
2613 if (delegate_)
2614 delegate_->DidReceiveCompositorFrame();
piman 2017/04/04 17:34:46 Should this move to the end of the function, or at
Saman Sami 2017/04/04 17:49:54 Done.
2615
2612 last_local_surface_id_ = local_surface_id; 2616 last_local_surface_id_ = local_surface_id;
2613 last_frame_size_ = frame_size; 2617 last_frame_size_ = frame_size;
2614 last_device_scale_factor_ = device_scale_factor; 2618 last_device_scale_factor_ = device_scale_factor;
2615 2619
2616 last_received_content_source_id_ = frame.metadata.content_source_id; 2620 last_received_content_source_id_ = frame.metadata.content_source_id;
2617 2621
2618 if (frame.metadata.begin_frame_ack.sequence_number < 2622 if (frame.metadata.begin_frame_ack.sequence_number <
2619 cc::BeginFrameArgs::kStartingFrameNumber) { 2623 cc::BeginFrameArgs::kStartingFrameNumber) {
2620 // Received an invalid ack, renderer misbehaved. 2624 // Received an invalid ack, renderer misbehaved.
2621 bad_message::ReceivedBadMessage( 2625 bad_message::ReceivedBadMessage(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 2659
2656 // After navigation, if a frame belonging to the new page is received, stop 2660 // After navigation, if a frame belonging to the new page is received, stop
2657 // the timer that triggers clearing the graphics of the last page. 2661 // the timer that triggers clearing the graphics of the last page.
2658 if (last_received_content_source_id_ >= current_content_source_id_ && 2662 if (last_received_content_source_id_ >= current_content_source_id_ &&
2659 new_content_rendering_timeout_->IsRunning()) { 2663 new_content_rendering_timeout_->IsRunning()) {
2660 new_content_rendering_timeout_->Stop(); 2664 new_content_rendering_timeout_->Stop();
2661 } 2665 }
2662 } 2666 }
2663 2667
2664 } // namespace content 2668 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698