Chromium Code Reviews| Index: content/common/gpu/image_transport_surface.h |
| =================================================================== |
| --- content/common/gpu/image_transport_surface.h (revision 108480) |
| +++ content/common/gpu/image_transport_surface.h (working copy) |
| @@ -8,9 +8,12 @@ |
| #if defined(ENABLE_GPU) |
| +#include "base/callback.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "ipc/ipc_channel.h" |
| #include "ipc/ipc_message.h" |
| +#include "ui/gfx/gl/gl_surface.h" |
| #include "ui/gfx/size.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/gfx/surface/transport_dib.h" |
| @@ -48,9 +51,13 @@ |
| class ImageTransportSurface { |
| public: |
| + ImageTransportSurface(); |
| + virtual ~ImageTransportSurface(); |
|
jonathan.backer
2011/11/03 23:09:07
This was meant to be an interface so as not to bre
apatrick_chromium
2011/11/07 20:40:04
The style guide actually requires that interface c
|
| + |
| virtual void OnNewSurfaceACK( |
| uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
| virtual void OnBuffersSwappedACK() = 0; |
| + virtual void OnResizeViewACK() = 0; |
| virtual void OnResize(gfx::Size size) = 0; |
| // Creates the appropriate surface depending on the GL implementation. |
| @@ -60,6 +67,8 @@ |
| int32 renderer_id, |
| int32 command_buffer_id, |
| gfx::PluginWindowHandle handle); |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); |
| }; |
| class ImageTransportHelper : public IPC::Channel::Listener { |
| @@ -87,10 +96,13 @@ |
| GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| void SendAcceleratedSurfaceRelease( |
| GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| + void SendResizeView(const gfx::Size& size); |
| // Whether or not we should execute more commands. |
| void SetScheduled(bool is_scheduled); |
| + void DeferToFence(base::Closure task); |
| + |
| // Make the surface's context current. |
| bool MakeCurrent(); |
| @@ -101,10 +113,14 @@ |
| // IPC::Message handlers. |
| void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle); |
| void OnBuffersSwappedACK(); |
| + void OnResizeViewACK(); |
| // Backbuffer resize callback. |
| void Resize(gfx::Size size); |
| + // Set the default swap interval on the surface. |
| + void SetSwapInterval(); |
| + |
| // Weak pointers that point to objects that outlive this helper. |
| ImageTransportSurface* surface_; |
| GpuChannelManager* manager_; |
| @@ -118,6 +134,36 @@ |
| DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); |
| }; |
| +// An implementation of ImageTransportSurface that implements GLSurface through |
| +// GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. |
| +class PassThroughImageTransportSurface |
| + : public gfx::GLSurfaceAdapter, |
|
jonathan.backer
2011/11/03 23:09:07
I suspect that this is the only GLSurfaceAdapter t
apatrick_chromium
2011/11/07 20:40:04
I added GLSurfaceAdapter to avoid making the inher
|
| + public ImageTransportSurface { |
| + public: |
| + PassThroughImageTransportSurface(GpuChannelManager* manager, |
| + int32 render_view_id, |
| + int32 renderer_id, |
| + int32 command_buffer_id, |
| + gfx::GLSurface* surface); |
| + virtual ~PassThroughImageTransportSurface(); |
| + |
| + // GLSurface implementation. |
| + virtual bool Initialize(); |
| + virtual void Destroy(); |
| + |
| + // ImageTransportSurface implementation. |
| + virtual void OnNewSurfaceACK( |
| + uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; |
| + virtual void OnBuffersSwappedACK() OVERRIDE; |
| + virtual void OnResizeViewACK() OVERRIDE; |
| + virtual void OnResize(gfx::Size size) OVERRIDE; |
| + |
| + private: |
| + scoped_ptr<ImageTransportHelper> helper_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| +}; |
| + |
| #endif // defined(ENABLE_GPU) |
| #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |