diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 08:35:48 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 08:35:48 +0000 |
commit | 1c0008845c0fc41e5d4db76b045848a70da3ca27 (patch) | |
tree | 0dec51cbc23e777b68e722d07cf663bf06057dcc /content | |
parent | a1827ff67c77c8650938989c526a4b7e51a258aa (diff) | |
download | chromium_src-1c0008845c0fc41e5d4db76b045848a70da3ca27.zip chromium_src-1c0008845c0fc41e5d4db76b045848a70da3ca27.tar.gz chromium_src-1c0008845c0fc41e5d4db76b045848a70da3ca27.tar.bz2 |
Reland r204014 - Don't track whether a resize ack is pending during layout tests
Unlike normal operation, in layout tests the renderer can request a synchronous
change of its size. The renderer and the browser therefore often run out of
sync. However, it's important that the renderer always acks a resize request
from the browser.
Previously, I tried to track the size the browser expects the renderer to have
in the renderer, however, this turns out to not work when the compositor is in
hidpi mode. Instead of trying to fix this up somehow, just ignore whether or
not the browser is expecting resize acks during layout tests
BUG=244369
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/15878016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_impl.cc | 11 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_impl.h | 3 | ||||
-rw-r--r-- | content/renderer/render_widget.cc | 15 | ||||
-rw-r--r-- | content/renderer/render_widget.h | 6 | ||||
-rw-r--r-- | content/test/layout_browsertest.cc | 3 | ||||
-rw-r--r-- | content/test/layouttest_support.cc | 2 |
6 files changed, 26 insertions, 14 deletions
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index f6a6d11..97493ca 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -85,6 +85,8 @@ using WebKit::WebTextDirection; namespace content { namespace { +bool g_check_for_pending_resize_ack = true; + // How long to (synchronously) wait for the renderer to respond with a // PaintRect message, when our backing-store is invalid, before giving up and // returning a null or incorrectly sized backing-store from GetBackingStore. @@ -547,7 +549,7 @@ void RenderWidgetHostImpl::WasResized() { // We don't expect to receive an ACK when the requested size or the physical // backing size is empty, or when the main viewport size didn't change. if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) - resize_ack_pending_ = true; + resize_ack_pending_ = g_check_for_pending_resize_ack; ViewMsg_Resize_Params params; params.screen_info = *screen_info_; @@ -1215,6 +1217,11 @@ int64 RenderWidgetHostImpl::GetLatencyComponentId() { return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); } +// static +void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { + g_check_for_pending_resize_ack = false; +} + ui::LatencyInfo RenderWidgetHostImpl::NewInputLatencyInfo() { ui::LatencyInfo info; info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_COMPONENT, @@ -1738,7 +1745,7 @@ void RenderWidgetHostImpl::OnUpdateRect( // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since // that will end up reaching GetBackingStore. if (is_resize_ack) { - DCHECK(resize_ack_pending_); + DCHECK(!g_check_for_pending_resize_ack || resize_ack_pending_); resize_ack_pending_ = false; in_flight_size_.SetSize(0, 0); } diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index d74c97f..c8aa64e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -488,6 +488,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, static void CompositorFrameDrawn(const ui::LatencyInfo& latency_info); + // Don't check whether we expected a resize ack during layout tests. + static void DisableResizeAckCheckForTesting(); + protected: virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() OVERRIDE; diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 35ed654..c9bd3f8 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -373,9 +373,13 @@ void RenderWidget::Resize(const gfx::Size& new_size, const gfx::Rect& resizer_rect, bool is_fullscreen, ResizeAck resize_ack) { - // A resize ack shouldn't be requested if we have not ACK'd the previous one. - DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); - DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); + if (!RenderThreadImpl::current() || // Will be NULL during unit tests. + !RenderThreadImpl::current()->layout_test_mode()) { + // A resize ack shouldn't be requested if we have not ACK'd the previous + // one. + DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); + DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); + } // Ignore this during shutdown. if (!webwidget_) @@ -412,7 +416,8 @@ void RenderWidget::Resize(const gfx::Size& new_size, // Resize should have caused an invalidation of the entire view. DCHECK(new_size.IsEmpty() || is_accelerated_compositing_active_ || paint_aggregator_.HasPendingUpdate()); - } else if (size_browser_expects_ == new_size) { + } else if (!RenderThreadImpl::current() || // Will be NULL during unit tests. + !RenderThreadImpl::current()->layout_test_mode()) { resize_ack = NO_RESIZE_ACK; } @@ -469,7 +474,6 @@ void RenderWidget::OnResize(const ViewMsg_Resize_Params& params) { Resize(params.new_size, params.physical_backing_size, params.overdraw_bottom_height, params.resizer_rect, params.is_fullscreen, SEND_RESIZE_ACK); - size_browser_expects_ = params.new_size; } void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { @@ -539,7 +543,6 @@ void RenderWidget::OnUpdateRectAck() { TRACE_EVENT0("renderer", "RenderWidget::OnUpdateRectAck"); DCHECK(update_reply_pending_); update_reply_pending_ = false; - size_browser_expects_ = size_; // If we sent an UpdateRect message with a zero-sized bitmap, then we should // have no current paint buffer. diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index b23525a..4ab6db0 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -534,12 +534,6 @@ class CONTENT_EXPORT RenderWidget // The size of the RenderWidget. gfx::Size size_; - // When short-circuiting size updates, the browser might not know about the - // current size of the RenderWidget. To be able to correctly predict when the - // browser expects a resize ack, keep track of the size the browser thinks - // this RenderWidget should have. - gfx::Size size_browser_expects_; - // The TransportDIB that is being used to transfer an image to the browser. TransportDIB* current_paint_buf_; diff --git a/content/test/layout_browsertest.cc b/content/test/layout_browsertest.cc index d2a2fd2..d6aeb25 100644 --- a/content/test/layout_browsertest.cc +++ b/content/test/layout_browsertest.cc @@ -19,6 +19,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/common/content_paths.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/layouttest_support.h" #include "content/shell/common/shell_switches.h" #include "content/shell/shell.h" #include "content/shell/webkit_test_controller.h" @@ -78,6 +79,8 @@ InProcessBrowserLayoutTest::~InProcessBrowserLayoutTest() { } void InProcessBrowserLayoutTest::SetUpInProcessBrowserTestFixture() { + EnableBrowserLayoutTestMode(); + base::FilePath src_dir; ASSERT_TRUE(PathService::Get(DIR_LAYOUT_TESTS, &src_dir)); base::FilePath absolute_parent_dir = src_dir.Append(test_parent_dir_); diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index 15251ed..4993130 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc @@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/lazy_instance.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/gpu/image_transport_surface.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" @@ -69,6 +70,7 @@ void EnableBrowserLayoutTestMode() { #elif defined(OS_WIN) && !defined(USE_AURA) WebContentsDragWin::DisableDragDropForTesting(); #endif + RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); } int GetLocalSessionHistoryLength(RenderView* render_view) { |