diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 22:29:16 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 22:29:16 +0000 |
commit | fa282ad09855ade5832411e0ee5a7cc64dda2484 (patch) | |
tree | df28692447720ab4978efd99b05fcda8d59e17e1 /content | |
parent | be70b395f0b474a01757f8dea88c2d1d3854c464 (diff) | |
download | chromium_src-fa282ad09855ade5832411e0ee5a7cc64dda2484.zip chromium_src-fa282ad09855ade5832411e0ee5a7cc64dda2484.tar.gz chromium_src-fa282ad09855ade5832411e0ee5a7cc64dda2484.tar.bz2 |
Revert 223140 "aura: When skipping frames, ensure next frame dam..."
compile errors that the trybots didn't catch??
> aura: When skipping frames, ensure next frame damages what was skipped.
>
> In the delegated path, if we skip a frame, we are just dropping the
> damage. If the resize lock times out, we can end up swapping a partial
> frame that is out of sync with the rest of the visible content.
>
> Since we always have all the quads available to us (unlike the old
> double-buffered texture path), when we stop skipping a frame, just
> damage the whole RenderWidgetHostView to ensure we draw the skipped
> frames' damage.
>
> Refactors ResizeLock out so that we can fake it out in tests.
>
> Tests:
> RenderWidgetHostViewAuraTest.SkippedDelegatedFrames
>
> R=jbauman, piman
> BUG=288993
> Depends on: https://codereview.chromium.org/23506032/
>
> Review URL: https://chromiumcodereview.appspot.com/23496042
TBR=danakj@chromium.org
Review URL: https://codereview.chromium.org/23455052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/aura/compositor_resize_lock.cc | 65 | ||||
-rw-r--r-- | content/browser/aura/compositor_resize_lock.h | 45 | ||||
-rw-r--r-- | content/browser/aura/resize_lock.cc | 35 | ||||
-rw-r--r-- | content/browser/aura/resize_lock.h | 37 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 193 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.h | 46 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc | 117 | ||||
-rw-r--r-- | content/content_browser.gypi | 4 |
8 files changed, 125 insertions, 417 deletions
diff --git a/content/browser/aura/compositor_resize_lock.cc b/content/browser/aura/compositor_resize_lock.cc deleted file mode 100644 index e80baba..0000000 --- a/content/browser/aura/compositor_resize_lock.cc +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/aura/compositor_resize_lock.h" - -#include "base/debug/trace_event.h" -#include "content/public/browser/browser_thread.h" -#include "ui/aura/root_window.h" -#include "ui/compositor/compositor.h" - -namespace content { - -CompositorResizeLock::CompositorResizeLock(aura::RootWindow* root_window, - const gfx::Size new_size, - bool defer_compositor_lock, - const base::TimeDelta& timeout) - : ResizeLock(new_size, defer_compositor_lock), - root_window_(root_window), - weak_ptr_factory_(this), - cancelled_(false) { - DCHECK(root_window_); - - TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this, - "width", expected_size().width(), - "height", expected_size().height()); - root_window_->HoldPointerMoves(); - - BrowserThread::PostDelayedTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&CompositorResizeLock::CancelLock, - weak_ptr_factory_.GetWeakPtr()), - timeout); -} - -CompositorResizeLock::~CompositorResizeLock() { - CancelLock(); - TRACE_EVENT_ASYNC_END2("ui", "CompositorResizeLock", this, - "width", expected_size().width(), - "height", expected_size().height()); -} - -bool CompositorResizeLock::GrabDeferredLock() { - return ResizeLock::GrabDeferredLock(); -} - -void CompositorResizeLock::UnlockCompositor() { - ResizeLock::UnlockCompositor(); - compositor_lock_ = NULL; -} - -void CompositorResizeLock::LockCompositor() { - ResizeLock::LockCompositor(); - compositor_lock_ = root_window_->compositor()->GetCompositorLock(); -} - -void CompositorResizeLock::CancelLock() { - if (cancelled_) - return; - cancelled_ = true; - UnlockCompositor(); - root_window_->ReleasePointerMoves(); -} - -} // namespace content diff --git a/content/browser/aura/compositor_resize_lock.h b/content/browser/aura/compositor_resize_lock.h deleted file mode 100644 index b4c1aec..0000000 --- a/content/browser/aura/compositor_resize_lock.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_AURA_RESIZE_LOCK_AURA_H_ -#define CONTENT_BROWSER_AURA_RESIZE_LOCK_AURA_H_ - -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" -#include "content/browser/aura/resize_lock.h" - -namespace aura { class RootWindow; } - -namespace ui { class CompositorLock; } - -namespace content { - -// Used to prevent further resizes while a resize is pending. -class CompositorResizeLock : public ResizeLock { - public: - CompositorResizeLock(aura::RootWindow* root_window, - const gfx::Size new_size, - bool defer_compositor_lock, - const base::TimeDelta& timeout); - virtual ~CompositorResizeLock(); - - virtual bool GrabDeferredLock() OVERRIDE; - virtual void UnlockCompositor() OVERRIDE; - - protected: - virtual void LockCompositor() OVERRIDE; - void CancelLock(); - - private: - aura::RootWindow* root_window_; - scoped_refptr<ui::CompositorLock> compositor_lock_; - base::WeakPtrFactory<CompositorResizeLock> weak_ptr_factory_; - bool cancelled_; - - DISALLOW_COPY_AND_ASSIGN(CompositorResizeLock); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_AURA_RESIZE_LOCK_AURA_H_ diff --git a/content/browser/aura/resize_lock.cc b/content/browser/aura/resize_lock.cc deleted file mode 100644 index 4c8cd95..0000000 --- a/content/browser/aura/resize_lock.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/aura/resize_lock.h" - -namespace content { - -ResizeLock::ResizeLock(const gfx::Size new_size, bool defer_compositor_lock) - : new_size_(new_size), - defer_compositor_lock_(defer_compositor_lock) { - if (!defer_compositor_lock_) - LockCompositor(); -} - -ResizeLock::~ResizeLock() { - UnlockCompositor(); -} - -bool ResizeLock::GrabDeferredLock() { - if (!defer_compositor_lock_) - return false; - LockCompositor(); - return true; -} - -void ResizeLock::UnlockCompositor() { - defer_compositor_lock_ = false; -} - -void ResizeLock::LockCompositor() { - defer_compositor_lock_ = false; -} - -} // namespace content diff --git a/content/browser/aura/resize_lock.h b/content/browser/aura/resize_lock.h deleted file mode 100644 index cff9822..0000000 --- a/content/browser/aura/resize_lock.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_AURA_RESIZE_LOCK_H_ -#define CONTENT_BROWSER_AURA_RESIZE_LOCK_H_ - -#include "base/basictypes.h" -#include "content/common/content_export.h" -#include "ui/gfx/size.h" - -namespace content { - -class CONTENT_EXPORT ResizeLock { - public: - virtual ~ResizeLock(); - - virtual bool GrabDeferredLock(); - virtual void UnlockCompositor(); - - const gfx::Size& expected_size() const { return new_size_; } - - protected: - ResizeLock(const gfx::Size new_size, bool defer_compositor_lock); - - virtual void LockCompositor(); - - private: - gfx::Size new_size_; - bool defer_compositor_lock_; - - DISALLOW_COPY_AND_ASSIGN(ResizeLock); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_AURA_RESIZE_LOCK_H_ diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 7abad81..d998867 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -19,7 +19,6 @@ #include "cc/resources/texture_mailbox.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h" -#include "content/browser/aura/compositor_resize_lock.h" #include "content/browser/renderer_host/backing_store_aura.h" #include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/overscroll_controller.h" @@ -574,6 +573,73 @@ class RenderWidgetHostViewAura::TransientWindowObserver #endif +class RenderWidgetHostViewAura::ResizeLock { + public: + ResizeLock(aura::RootWindow* root_window, + const gfx::Size new_size, + bool defer_compositor_lock) + : root_window_(root_window), + new_size_(new_size), + compositor_lock_(defer_compositor_lock ? + NULL : + root_window_->compositor()->GetCompositorLock()), + weak_ptr_factory_(this), + defer_compositor_lock_(defer_compositor_lock) { + TRACE_EVENT_ASYNC_BEGIN2("ui", "ResizeLock", this, + "width", new_size_.width(), + "height", new_size_.height()); + root_window_->HoldPointerMoves(); + + BrowserThread::PostDelayedTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&RenderWidgetHostViewAura::ResizeLock::CancelLock, + weak_ptr_factory_.GetWeakPtr()), + base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs)); + } + + ~ResizeLock() { + CancelLock(); + TRACE_EVENT_ASYNC_END2("ui", "ResizeLock", this, + "width", new_size_.width(), + "height", new_size_.height()); + } + + void UnlockCompositor() { + defer_compositor_lock_ = false; + compositor_lock_ = NULL; + } + + void CancelLock() { + if (!root_window_) + return; + UnlockCompositor(); + root_window_->ReleasePointerMoves(); + root_window_ = NULL; + } + + const gfx::Size& expected_size() const { + return new_size_; + } + + bool GrabDeferredLock() { + if (root_window_ && defer_compositor_lock_) { + compositor_lock_ = root_window_->compositor()->GetCompositorLock(); + defer_compositor_lock_ = false; + return true; + } + return false; + } + + private: + aura::RootWindow* root_window_; + gfx::Size new_size_; + scoped_refptr<ui::CompositorLock> compositor_lock_; + base::WeakPtrFactory<ResizeLock> weak_ptr_factory_; + bool defer_compositor_lock_; + + DISALLOW_COPY_AND_ASSIGN(ResizeLock); +}; + //////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewAura, public: @@ -590,7 +656,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) can_compose_inline_(true), has_composition_text_(false), last_output_surface_id_(0), - skipped_frames_(false), last_swapped_surface_scale_factor_(1.f), paint_canvas_(NULL), synthetic_move_sent_(false), @@ -746,69 +811,39 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { } void RenderWidgetHostViewAura::MaybeCreateResizeLock() { - if (!ShouldCreateResizeLock()) - return; - DCHECK(window_->GetRootWindow()); - DCHECK(window_->GetRootWindow()->compositor()); - - // Listen to changes in the compositor lock state. - ui::Compositor* compositor = window_->GetRootWindow()->compositor(); - if (!compositor->HasObserver(this)) - compositor->AddObserver(this); - - bool defer_compositor_lock = - can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || - can_lock_compositor_ == NO_PENDING_COMMIT; - - if (can_lock_compositor_ == YES) - can_lock_compositor_ = YES_DID_LOCK; - - resize_lock_ = CreateResizeLock(defer_compositor_lock); -} - -bool RenderWidgetHostViewAura::ShouldCreateResizeLock() { - // On Windows while resizing, the the resize locks makes us mis-paint a white - // vertical strip (including the non-client area) if the content composition - // is lagging the UI composition. So here we disable the throttling so that - // the UI bits can draw ahead of the content thereby reducing the amount of - // whiteout. Because this causes the content to be drawn at wrong sizes while - // resizing we compensate by blocking the UI thread in Compositor::Draw() by - // issuing a FinishAllRendering() if we are resizing. -#if defined (OS_WIN) - return false; -#endif - - if (resize_lock_) - return false; - - if (host_->should_auto_resize()) - return false; - if (!host_->is_accelerated_compositing_active()) - return false; - - gfx::Size desired_size = window_->bounds().size(); - if (desired_size == current_frame_size_) - return false; - - aura::RootWindow* root_window = window_->GetRootWindow(); - if (!root_window) - return false; - - ui::Compositor* compositor = root_window->compositor(); - if (!compositor) - return false; - - return true; -} - -scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( - bool defer_compositor_lock) { gfx::Size desired_size = window_->bounds().size(); - return scoped_ptr<ResizeLock>(new CompositorResizeLock( - window_->GetRootWindow(), - desired_size, - defer_compositor_lock, - base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); + if (!host_->should_auto_resize() && + !resize_lock_.get() && + desired_size != current_frame_size_ && + host_->is_accelerated_compositing_active()) { + aura::RootWindow* root_window = window_->GetRootWindow(); + ui::Compositor* compositor = root_window ? + root_window->compositor() : NULL; + if (root_window && compositor) { + // Listen to changes in the compositor lock state. + if (!compositor->HasObserver(this)) + compositor->AddObserver(this); + +// On Windows while resizing, the the resize locks makes us mis-paint a white +// vertical strip (including the non-client area) if the content composition is +// lagging the UI composition. So here we disable the throttling so that the UI +// bits can draw ahead of the content thereby reducing the amount of whiteout. +// Because this causes the content to be drawn at wrong sizes while resizing +// we compensate by blocking the UI thread in Compositor::Draw() by issuing a +// FinishAllRendering() if we are resizing. +#if !defined (OS_WIN) + bool defer_compositor_lock = + can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || + can_lock_compositor_ == NO_PENDING_COMMIT; + + if (can_lock_compositor_ == YES) + can_lock_compositor_ = YES_DID_LOCK; + + resize_lock_.reset(new ResizeLock(root_window, desired_size, + defer_compositor_lock)); +#endif + } + } } gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { @@ -1405,25 +1440,17 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame( scoped_ptr<cc::DelegatedFrameData> frame_data, float frame_device_scale_factor, const ui::LatencyInfo& latency_info) { - gfx::Size frame_size; gfx::Size frame_size_in_dip; - gfx::Rect damage_rect; gfx::Rect damage_rect_in_dip; - if (!frame_data->render_pass_list.empty()) { cc::RenderPass* root_pass = frame_data->render_pass_list.back(); - - frame_size = root_pass->output_rect.size(); - frame_size_in_dip = ConvertSizeToDIP(frame_device_scale_factor, frame_size); - - damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect); - damage_rect.Intersect(gfx::Rect(frame_size)); - damage_rect_in_dip = ConvertRectToDIP(frame_device_scale_factor, - damage_rect); + frame_size_in_dip = ConvertSizeToDIP(frame_device_scale_factor, + root_pass->output_rect.size()); + damage_rect_in_dip = ConvertRectToDIP( + frame_device_scale_factor, + gfx::ToEnclosingRect(root_pass->damage_rect)); } - framebuffer_holder_ = NULL; - if (ShouldSkipFrame(frame_size_in_dip)) { cc::CompositorFrameAck ack; cc::TransferableResource::ReturnResources(frame_data->resource_list, @@ -1431,20 +1458,8 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame( RenderWidgetHostImpl::SendSwapCompositorFrameAck( host_->GetRoutingID(), output_surface_id, host_->GetProcess()->GetID(), ack); - skipped_frames_ = true; return; } - - if (skipped_frames_) { - skipped_frames_ = false; - damage_rect = gfx::Rect(frame_size); - damage_rect_in_dip = gfx::Rect(frame_size_in_dip); - - // Give the same damage rect to the compositor. - cc::RenderPass* root_pass = frame_data->render_pass_list.back(); - root_pass->damage_rect = damage_rect; - } - if (output_surface_id != last_output_surface_id_) { // Resource ids are scoped by the output surface. // If the originating output surface doesn't match the last one, it diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 5b3853f..7f03b09 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -59,10 +59,9 @@ namespace content { class MemoryHolder; class RenderWidgetHostImpl; class RenderWidgetHostView; -class ResizeLock; // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. -class CONTENT_EXPORT RenderWidgetHostViewAura +class RenderWidgetHostViewAura : public RenderWidgetHostViewBase, public ui::CompositorObserver, public ui::TextInputClient, @@ -338,21 +337,26 @@ class CONTENT_EXPORT RenderWidgetHostViewAura protected: friend class RenderWidgetHostView; - virtual ~RenderWidgetHostViewAura(); - // Should be constructed via RenderWidgetHostView::CreateViewForWidget. + // Should construct only via RenderWidgetHostView::CreateViewForWidget. explicit RenderWidgetHostViewAura(RenderWidgetHost* host); RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { return frame_subscriber_.get(); } - virtual bool ShouldCreateResizeLock(); - virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock); + private: + FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); + FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); + FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); + FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); - // Exposed for tests. - aura::Window* window() { return window_; } - gfx::Size current_frame_size() const { return current_frame_size_; } + class WindowObserver; + friend class WindowObserver; +#if defined(OS_WIN) + class TransientWindowObserver; + friend class TransientWindowObserver; +#endif // Overridden from ui::CompositorObserver: virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; @@ -366,21 +370,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE; - private: - FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); - FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); - FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); - FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); - FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, - SkippedDelegatedFrames); - - class WindowObserver; - friend class WindowObserver; -#if defined(OS_WIN) - class TransientWindowObserver; - friend class TransientWindowObserver; -#endif - // Overridden from ImageTransportFactoryObserver: virtual void OnLostResources() OVERRIDE; @@ -396,6 +385,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura virtual gfx::Point GetLastTouchEventLocation() const OVERRIDE; virtual void FatalAccessibilityTreeError() OVERRIDE; + virtual ~RenderWidgetHostViewAura(); + void UpdateCursorIfOverSelf(); bool ShouldSkipFrame(gfx::Size size_in_dip) const; @@ -608,10 +599,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // Pending damage from previous frames that we skipped. SkRegion skipped_damage_; - // True after a delegated frame has been skipped, until a frame is not - // skipped. - bool skipped_frames_; - // The size of the last frame that was swapped (even if we skipped it). // Used to determine when the skipped_damage_ needs to be reset due to // size changes between front- and backbuffer. @@ -643,6 +630,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // software backing store is updated. bool accelerated_compositing_state_changed_; + // Used to prevent further resizes while a resize is pending. + class ResizeLock; + // This lock is the one waiting for a frame of the right size to come back // from the renderer/GPU process. It is set from the moment the aura window // got resized, to the moment we committed the renderer frame of the same diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 8fb69c7..5d999f9 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -11,7 +11,6 @@ #include "cc/output/compositor_frame.h" #include "cc/output/compositor_frame_metadata.h" #include "cc/output/gl_frame_data.h" -#include "content/browser/aura/resize_lock.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_impl.h" @@ -38,8 +37,6 @@ #include "ui/base/events/event_utils.h" #include "ui/base/ui_base_types.h" -using testing::_; - namespace content { namespace { class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { @@ -79,41 +76,6 @@ class TestWindowObserver : public aura::WindowObserver { DISALLOW_COPY_AND_ASSIGN(TestWindowObserver); }; -class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { - public: - FakeRenderWidgetHostViewAura(RenderWidgetHost* widget) - : RenderWidgetHostViewAura(widget), has_resize_lock_(false) {} - - virtual ~FakeRenderWidgetHostViewAura() {} - - virtual bool ShouldCreateResizeLock() OVERRIDE { - gfx::Size desired_size = window()->bounds().size(); - return desired_size != current_frame_size(); - } - - virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock) - OVERRIDE { - gfx::Size desired_size = window()->bounds().size(); - return scoped_ptr<ResizeLock>( - new FakeResizeLock(desired_size, defer_compositor_lock)); - } - - void RunOnCompositingDidCommit() { - OnCompositingDidCommit(window()->GetRootWindow()->compositor()); - } - - // A lock that doesn't actually do anything to the compositor, and does not - // time out. - class FakeResizeLock : public ResizeLock { - public: - FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) - : ResizeLock(new_size, defer_compositor_lock) {} - }; - - bool has_resize_lock_; - gfx::Size last_frame_size_; -}; - class RenderWidgetHostViewAuraTest : public testing::Test { public: RenderWidgetHostViewAuraTest() @@ -141,9 +103,8 @@ class RenderWidgetHostViewAuraTest : public testing::Test { widget_host_ = new RenderWidgetHostImpl( &delegate_, process_host, MSG_ROUTING_NONE, false); widget_host_->Init(); - widget_host_->OnMessageReceived( - ViewHostMsg_DidActivateAcceleratedCompositing(0, true)); - view_ = new FakeRenderWidgetHostViewAura(widget_host_); + view_ = static_cast<RenderWidgetHostViewAura*>( + RenderWidgetHostView::CreateViewForWidget(widget_host_)); } virtual void TearDown() { @@ -178,7 +139,7 @@ class RenderWidgetHostViewAuraTest : public testing::Test { // Tests should set these to NULL if they've already triggered their // destruction. RenderWidgetHostImpl* widget_host_; - FakeRenderWidgetHostViewAura* view_; + RenderWidgetHostViewAura* view_; IPC::TestSink* sink_; @@ -772,76 +733,4 @@ TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { view_->window_->RemoveObserver(&observer); } -// Skipped frames should not drop their damage. -TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { - gfx::Rect view_rect(100, 100); - gfx::Size frame_size = view_rect.size(); - - view_->InitAsChild(NULL); - view_->GetNativeView()->SetDefaultParentByRootWindow( - parent_view_->GetNativeView()->GetRootWindow(), gfx::Rect()); - view_->SetSize(view_rect.size()); - - MockWindowObserver observer; - view_->window_->AddObserver(&observer); - - // A full frame of damage. - EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, view_rect)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - // A partial damage frame. - gfx::Rect partial_view_rect(30, 30, 20, 20); - EXPECT_CALL(observer, - OnWindowPaintScheduled(view_->window_, partial_view_rect)); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - // Lock the compositor. Now we should drop frames. - view_rect = gfx::Rect(150, 150); - view_->SetSize(view_rect.size()); - view_->MaybeCreateResizeLock(); - - // This frame is dropped. - gfx::Rect dropped_damage_rect_1(10, 20, 30, 40); - EXPECT_CALL(observer, OnWindowPaintScheduled(_, _)).Times(0); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_1)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - gfx::Rect dropped_damage_rect_2(40, 50, 10, 20); - EXPECT_CALL(observer, OnWindowPaintScheduled(_, _)).Times(0); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_2)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - // Unlock the compositor. This frame should damage everything. - frame_size = view_rect.size(); - - gfx::Rect new_damage_rect(5, 6, 10, 10); - EXPECT_CALL(observer, - OnWindowPaintScheduled(view_->window_, view_rect)); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, new_damage_rect)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - // A partial damage frame, this should not be dropped. - EXPECT_CALL(observer, - OnWindowPaintScheduled(view_->window_, partial_view_rect)); - view_->OnSwapCompositorFrame( - 0, MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); - testing::Mock::VerifyAndClearExpectations(&observer); - view_->RunOnCompositingDidCommit(); - - - view_->window_->RemoveObserver(&observer); -} - } // namespace content diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 49bd34d..f97f544 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -291,8 +291,6 @@ 'browser/aura/browser_compositor_output_surface.h', 'browser/aura/browser_compositor_output_surface_proxy.cc', 'browser/aura/browser_compositor_output_surface_proxy.h', - 'browser/aura/compositor_resize_lock.cc', - 'browser/aura/compositor_resize_lock.h', 'browser/aura/gpu_process_transport_factory.cc', 'browser/aura/gpu_process_transport_factory.h', 'browser/aura/image_transport_factory.cc', @@ -301,8 +299,6 @@ 'browser/aura/no_transport_image_transport_factory.h', 'browser/aura/reflector_impl.cc', 'browser/aura/reflector_impl.h', - 'browser/aura/resize_lock.cc', - 'browser/aura/resize_lock.h', 'browser/aura/software_browser_compositor_output_surface.cc', 'browser/aura/software_browser_compositor_output_surface.h', 'browser/aura/software_output_device_win.cc', |