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

Unified Diff: ui/aura/root_window.h

Issue 9838045: aura: fast resizes for accelerated pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/root_window.h
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index 948ef2fce3532bc848c1099ddc1d8db532281016..9adcaefecb5baf0f988ff8f4fc99c82b3b82b529 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
@@ -33,6 +34,7 @@ class Transform;
namespace aura {
+class RootWindow;
class RootWindowHost;
class RootWindowObserver;
class KeyEvent;
@@ -42,6 +44,31 @@ class ScrollEvent;
class TouchEvent;
class GestureEvent;
+// This class represents a lock on the compositor, that can be used to prevent a
+// compositing pass from happening while we're waiting for an asynchronous
+// event. The typical use case is when waiting for a renderer to produce a frame
+// at the right size. The caller keeps a reference on this object, and drops the
+// reference once it desires to release the lock.
+// Note however that the lock is canceled after a short timeout to ensure
+// responsiveness of the UI, so the compositor tree should be kept in a
+// "reasonable" state while the lock is held.
+// Don't instantiate this class directly, use RootWindow::GetCompositorLock.
+class CompositorLock :
+ public base::RefCounted<CompositorLock>,
+ public base::SupportsWeakPtr<CompositorLock> {
+ public:
+ ~CompositorLock();
+
+ private:
+ friend class RootWindow;
+
+ CompositorLock(RootWindow* root_window);
+ void CancelLock();
+
+ RootWindow* root_window_;
+ DISALLOW_COPY_AND_ASSIGN(CompositorLock);
+};
+
// RootWindow is responsible for hosting a set of windows.
class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
public ui::CompositorObserver,
@@ -189,6 +216,9 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
void HoldMouseMoves();
void ReleaseMouseMoves();
+ // Creates a compositor lock.
+ scoped_refptr<CompositorLock> GetCompositorLock();
+
// Overridden from Window:
virtual RootWindow* GetRootWindow() OVERRIDE;
virtual const RootWindow* GetRootWindow() const OVERRIDE;
@@ -203,6 +233,7 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
private:
friend class Window;
+ friend class CompositorLock;
// Called whenever the mouse moves, tracks the current |mouse_moved_handler_|,
// sending exited and entered events as its value changes.
@@ -268,6 +299,9 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
// current mouse location.
void SynthesizeMouseMoveEvent();
+ // Called by CompositorLock.
+ void UnlockCompositor();
+
scoped_ptr<ui::Compositor> compositor_;
scoped_ptr<RootWindowHost> host_;
@@ -320,6 +354,9 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
bool should_hold_mouse_moves_;
scoped_ptr<MouseEvent> held_mouse_move_;
+ CompositorLock* compositor_lock_;
+ bool scheduled_while_locked_;
+
DISALLOW_COPY_AND_ASSIGN(RootWindow);
};

Powered by Google App Engine
This is Rietveld 408576698