Index: ui/gfx/compositor/compositor.h |
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h |
index 42bb770cd756f0958b3a5db73b2f4e88310a5026..4bcc743edd7301b32c14559ad754d732ec1d08f3 100644 |
--- a/ui/gfx/compositor/compositor.h |
+++ b/ui/gfx/compositor/compositor.h |
@@ -7,6 +7,7 @@ |
#pragma once |
#include "base/memory/ref_counted.h" |
+#include "base/observer_list.h" |
#include "ui/gfx/compositor/compositor_export.h" |
#include "ui/gfx/transform.h" |
#include "ui/gfx/native_widget_types.h" |
@@ -20,6 +21,8 @@ class Rect; |
namespace ui { |
+class CompositorObserver; |
+ |
struct TextureDrawParams { |
TextureDrawParams() : transform(), blend(false), compositor_size() {} |
@@ -81,10 +84,10 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { |
virtual Texture* CreateTexture() = 0; |
// Notifies the compositor that compositing is about to start. |
- virtual void NotifyStart() = 0; |
+ void NotifyStart(); |
// Notifies the compositor that compositing is complete. |
- virtual void NotifyEnd() = 0; |
+ void NotifyEnd(); |
// Blurs the specific region in the compositor. |
virtual void Blur(const gfx::Rect& bounds) = 0; |
@@ -102,15 +105,28 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { |
// Returns the size of the widget that is being drawn to. |
const gfx::Size& size() { return size_; } |
+ // Layers do not own observers. It is the responsibility of the observer to |
+ // remove itself when it is done observing. |
+ void AddObserver(CompositorObserver* observer); |
+ void RemoveObserver(CompositorObserver* observer); |
+ |
protected: |
explicit Compositor(const gfx::Size& size) : size_(size) {} |
virtual ~Compositor() {} |
+ // Notifies the compositor that compositing is about to start. |
+ virtual void OnNotifyStart() = 0; |
+ |
+ // Notifies the compositor that compositing is complete. |
+ virtual void OnNotifyEnd() = 0; |
+ |
virtual void OnWidgetSizeChanged() = 0; |
private: |
gfx::Size size_; |
+ ObserverList<CompositorObserver> observer_list_; |
+ |
friend class base::RefCounted<Compositor>; |
}; |