| 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);
|
| };
|
|
|
|
|