Chromium Code Reviews| Index: ui/gfx/compositor/compositor.h |
| diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h |
| index 01e20e79014dee9da0175472b9086ab1eb316770..df4d482cb985a4b5fdb6d5fc8ef5ac6e6eea2ad2 100644 |
| --- a/ui/gfx/compositor/compositor.h |
| +++ b/ui/gfx/compositor/compositor.h |
| @@ -63,6 +63,16 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { |
| friend class base::RefCounted<Texture>; |
| }; |
| +// An interface to allow the compositor to communicate with its owner. |
| +class COMPOSITOR_EXPORT CompositorOwner { |
|
sky
2011/09/06 17:39:01
Call this CompositorDelegate
sadrul
2011/09/06 18:13:23
Done.
|
| + public: |
| + // Returns the AcceleratedWidget the compositor should paint onto. |
| + virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
|
sky
2011/09/06 17:39:01
I prefer passing this into the constructor rather
sadrul
2011/09/06 18:13:23
Done.
|
| + |
| + // Refreshes the textures. The Compositor calls this after a SchedulePaint. |
|
sky
2011/09/06 17:39:01
I don't like having yet another paint coalescing c
sadrul
2011/09/06 18:13:23
Sounds like a good plan. Done.
|
| + virtual void PaintNow() = 0; |
| +}; |
| + |
| // Compositor object to take care of GPU painting. |
| // A Browser compositor object is responsible for generating the final |
| // displayable form of pixels comprising a single widget's contents. It draws an |
| @@ -71,7 +81,7 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { |
| class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { |
| public: |
| // Create a compositor from the provided handle. |
| - static Compositor* Create(gfx::AcceleratedWidget widget, |
| + static Compositor* Create(CompositorOwner* owner, |
| const gfx::Size& size); |
| // Creates a new texture. The caller owns the returned object. |
| @@ -100,12 +110,17 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { |
| const gfx::Size& size() { return size_; } |
| protected: |
| - explicit Compositor(const gfx::Size& size) : size_(size) {} |
| + Compositor(CompositorOwner* owner, const gfx::Size& size) |
| + : owner_(owner), |
| + size_(size) {} |
| virtual ~Compositor() {} |
| virtual void OnWidgetSizeChanged() = 0; |
| + CompositorOwner* owner() { return owner_; } |
| + |
| private: |
| + CompositorOwner* owner_; |
| gfx::Size size_; |
| friend class base::RefCounted<Compositor>; |