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

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

Issue 18413004: Fix false positive/negative resize_ack_pending_ in RenderWidgetHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 5 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 process_->SurfaceUpdated(surface_id_); 354 process_->SurfaceUpdated(surface_id_);
355 } 355 }
356 356
357 void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() { 357 void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() {
358 resize_ack_pending_ = false; 358 resize_ack_pending_ = false;
359 if (repaint_ack_pending_) { 359 if (repaint_ack_pending_) {
360 TRACE_EVENT_ASYNC_END0( 360 TRACE_EVENT_ASYNC_END0(
361 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); 361 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
362 } 362 }
363 repaint_ack_pending_ = false; 363 repaint_ack_pending_ = false;
364 in_flight_size_.SetSize(0, 0); 364 last_requested_size_.SetSize(0, 0);
365 } 365 }
366 366
367 void RenderWidgetHostImpl::SendScreenRects() { 367 void RenderWidgetHostImpl::SendScreenRects() {
368 if (!renderer_initialized_ || waiting_for_screen_rects_ack_) 368 if (!renderer_initialized_ || waiting_for_screen_rects_ack_)
369 return; 369 return;
370 370
371 if (is_hidden_) { 371 if (is_hidden_) {
372 // On GTK, this comes in for backgrounded tabs. Ignore, to match what 372 // On GTK, this comes in for backgrounded tabs. Ignore, to match what
373 // happens on Win & Mac, and when the view is shown it'll call this again. 373 // happens on Win & Mac, and when the view is shown it'll call this again.
374 return; 374 return;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 gfx::Rect view_bounds = view_->GetViewBounds(); 584 gfx::Rect view_bounds = view_->GetViewBounds();
585 gfx::Size new_size(view_bounds.size()); 585 gfx::Size new_size(view_bounds.size());
586 586
587 gfx::Size old_physical_backing_size = physical_backing_size_; 587 gfx::Size old_physical_backing_size = physical_backing_size_;
588 physical_backing_size_ = view_->GetPhysicalBackingSize(); 588 physical_backing_size_ = view_->GetPhysicalBackingSize();
589 bool was_fullscreen = is_fullscreen_; 589 bool was_fullscreen = is_fullscreen_;
590 is_fullscreen_ = IsFullscreen(); 590 is_fullscreen_ = IsFullscreen();
591 float old_overdraw_bottom_height = overdraw_bottom_height_; 591 float old_overdraw_bottom_height = overdraw_bottom_height_;
592 overdraw_bottom_height_ = view_->GetOverdrawBottomHeight(); 592 overdraw_bottom_height_ = view_->GetOverdrawBottomHeight();
593 593
594 bool size_changed = new_size != current_size_; 594 bool size_changed = new_size != last_requested_size_;
595 bool side_payload_changed = 595 bool side_payload_changed =
596 screen_info_out_of_date_ || 596 screen_info_out_of_date_ ||
597 old_physical_backing_size != physical_backing_size_ || 597 old_physical_backing_size != physical_backing_size_ ||
598 was_fullscreen != is_fullscreen_ || 598 was_fullscreen != is_fullscreen_ ||
599 old_overdraw_bottom_height != overdraw_bottom_height_; 599 old_overdraw_bottom_height != overdraw_bottom_height_;
600 600
601 if (!size_changed && !side_payload_changed) 601 if (!size_changed && !side_payload_changed)
602 return; 602 return;
603 603
604 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ &&
605 !side_payload_changed)
606 return;
607
608 if (!screen_info_) { 604 if (!screen_info_) {
609 screen_info_.reset(new WebKit::WebScreenInfo); 605 screen_info_.reset(new WebKit::WebScreenInfo);
610 GetWebScreenInfo(screen_info_.get()); 606 GetWebScreenInfo(screen_info_.get());
611 } 607 }
612 608
613 // We don't expect to receive an ACK when the requested size or the physical 609 // We don't expect to receive an ACK when the requested size or the physical
614 // backing size is empty, or when the main viewport size didn't change. 610 // backing size is empty, or when the main viewport size didn't change.
615 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) 611 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed)
616 resize_ack_pending_ = g_check_for_pending_resize_ack; 612 resize_ack_pending_ = g_check_for_pending_resize_ack;
617 613
618 ViewMsg_Resize_Params params; 614 ViewMsg_Resize_Params params;
619 params.screen_info = *screen_info_; 615 params.screen_info = *screen_info_;
620 params.new_size = new_size; 616 params.new_size = new_size;
621 params.physical_backing_size = physical_backing_size_; 617 params.physical_backing_size = physical_backing_size_;
622 params.overdraw_bottom_height = overdraw_bottom_height_; 618 params.overdraw_bottom_height = overdraw_bottom_height_;
623 params.resizer_rect = GetRootWindowResizerRect(); 619 params.resizer_rect = GetRootWindowResizerRect();
624 params.is_fullscreen = is_fullscreen_; 620 params.is_fullscreen = is_fullscreen_;
625 if (!Send(new ViewMsg_Resize(routing_id_, params))) { 621 if (!Send(new ViewMsg_Resize(routing_id_, params))) {
626 resize_ack_pending_ = false; 622 resize_ack_pending_ = false;
627 } else { 623 } else {
628 in_flight_size_ = new_size; 624 last_requested_size_ = new_size;
629 } 625 }
630 } 626 }
631 627
632 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { 628 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) {
633 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); 629 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect));
634 } 630 }
635 631
636 void RenderWidgetHostImpl::GotFocus() { 632 void RenderWidgetHostImpl::GotFocus() {
637 Focus(); 633 Focus();
638 } 634 }
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 last_scroll_offset_ = params.scroll_offset; 1836 last_scroll_offset_ = params.scroll_offset;
1841 1837
1842 bool is_resize_ack = 1838 bool is_resize_ack =
1843 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 1839 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
1844 1840
1845 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since 1841 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since
1846 // that will end up reaching GetBackingStore. 1842 // that will end up reaching GetBackingStore.
1847 if (is_resize_ack) { 1843 if (is_resize_ack) {
1848 DCHECK(!g_check_for_pending_resize_ack || resize_ack_pending_); 1844 DCHECK(!g_check_for_pending_resize_ack || resize_ack_pending_);
1849 resize_ack_pending_ = false; 1845 resize_ack_pending_ = false;
1850 in_flight_size_.SetSize(0, 0);
1851 } 1846 }
1852 1847
1853 bool is_repaint_ack = 1848 bool is_repaint_ack =
1854 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags); 1849 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags);
1855 if (is_repaint_ack) { 1850 if (is_repaint_ack) {
1856 DCHECK(repaint_ack_pending_); 1851 DCHECK(repaint_ack_pending_);
1857 TRACE_EVENT_ASYNC_END0( 1852 TRACE_EVENT_ASYNC_END0(
1858 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); 1853 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
1859 repaint_ack_pending_ = false; 1854 repaint_ack_pending_ = false;
1860 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; 1855 TimeDelta delta = TimeTicks::Now() - repaint_start_time_;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 int process_id = (b->first.second >> 32) & 0xffffffff; 2689 int process_id = (b->first.second >> 32) & 0xffffffff;
2695 RenderWidgetHost* rwh = 2690 RenderWidgetHost* rwh =
2696 RenderWidgetHost::FromID(process_id, routing_id); 2691 RenderWidgetHost::FromID(process_id, routing_id);
2697 if (!rwh) 2692 if (!rwh)
2698 continue; 2693 continue;
2699 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); 2694 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info);
2700 } 2695 }
2701 } 2696 }
2702 2697
2703 } // namespace content 2698 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698