summaryrefslogtreecommitdiffstats
path: root/content/browser/aura
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-14 05:33:29 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-14 05:33:29 +0000
commited66d1c729afdad61eb7a37e6b635a38ca5c0d94 (patch)
tree4ea269e8595742b5f5f12f5ab60eefad69fe6c8d /content/browser/aura
parent8fe650c2437a58ebdbf373a80a93582ff3e5ac48 (diff)
downloadchromium_src-ed66d1c729afdad61eb7a37e6b635a38ca5c0d94.zip
chromium_src-ed66d1c729afdad61eb7a37e6b635a38ca5c0d94.tar.gz
chromium_src-ed66d1c729afdad61eb7a37e6b635a38ca5c0d94.tar.bz2
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/ Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=223140 Review URL: https://chromiumcodereview.appspot.com/23496042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/aura')
-rw-r--r--content/browser/aura/compositor_resize_lock.cc65
-rw-r--r--content/browser/aura/compositor_resize_lock.h46
-rw-r--r--content/browser/aura/image_transport_factory.h2
-rw-r--r--content/browser/aura/resize_lock.cc35
-rw-r--r--content/browser/aura/resize_lock.h37
5 files changed, 184 insertions, 1 deletions
diff --git a/content/browser/aura/compositor_resize_lock.cc b/content/browser/aura/compositor_resize_lock.cc
new file mode 100644
index 0000000..e80baba
--- /dev/null
+++ b/content/browser/aura/compositor_resize_lock.cc
@@ -0,0 +1,65 @@
+// 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
new file mode 100644
index 0000000..51787e4
--- /dev/null
+++ b/content/browser/aura/compositor_resize_lock.h
@@ -0,0 +1,46 @@
+// 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 "base/time/time.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/image_transport_factory.h b/content/browser/aura/image_transport_factory.h
index e5964809..7cd2523 100644
--- a/content/browser/aura/image_transport_factory.h
+++ b/content/browser/aura/image_transport_factory.h
@@ -28,7 +28,7 @@ namespace content {
class GLHelper;
// This class provides a way to get notified when surface handles get lost.
-class ImageTransportFactoryObserver {
+class CONTENT_EXPORT ImageTransportFactoryObserver {
public:
virtual ~ImageTransportFactoryObserver() {}
diff --git a/content/browser/aura/resize_lock.cc b/content/browser/aura/resize_lock.cc
new file mode 100644
index 0000000..4c8cd95
--- /dev/null
+++ b/content/browser/aura/resize_lock.cc
@@ -0,0 +1,35 @@
+// 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
new file mode 100644
index 0000000..cff9822
--- /dev/null
+++ b/content/browser/aura/resize_lock.h
@@ -0,0 +1,37 @@
+// 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_