| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
| 15 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 16 #include "ui/gfx/gl/gl_surface.h" | 16 #include "ui/gfx/gl/gl_surface.h" |
| 17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/surface/transport_dib.h" | 19 #include "ui/gfx/surface/transport_dib.h" |
| 20 | 20 |
| 21 class GpuChannelManager; | 21 class GpuChannelManager; |
| 22 | 22 |
| 23 struct GpuHostMsg_AcceleratedSurfaceNew_Params; | 23 struct GpuHostMsg_AcceleratedSurfaceNew_Params; |
| 24 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 24 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 25 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 25 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 26 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| 26 | 27 |
| 27 namespace gfx { | 28 namespace gfx { |
| 28 class GLSurface; | 29 class GLSurface; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace gpu { | 32 namespace gpu { |
| 32 class GpuScheduler; | 33 class GpuScheduler; |
| 33 | 34 |
| 34 namespace gles2 { | 35 namespace gles2 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 // allowing the ImageTransportSurface to send events to the outside world. | 51 // allowing the ImageTransportSurface to send events to the outside world. |
| 51 | 52 |
| 52 class ImageTransportSurface { | 53 class ImageTransportSurface { |
| 53 public: | 54 public: |
| 54 ImageTransportSurface(); | 55 ImageTransportSurface(); |
| 55 virtual ~ImageTransportSurface(); | 56 virtual ~ImageTransportSurface(); |
| 56 | 57 |
| 57 virtual void OnNewSurfaceACK( | 58 virtual void OnNewSurfaceACK( |
| 58 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | 59 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
| 59 virtual void OnBuffersSwappedACK() = 0; | 60 virtual void OnBuffersSwappedACK() = 0; |
| 61 virtual void OnPostSubBufferACK() = 0; |
| 60 virtual void OnResizeViewACK() = 0; | 62 virtual void OnResizeViewACK() = 0; |
| 61 virtual void OnResize(gfx::Size size) = 0; | 63 virtual void OnResize(gfx::Size size) = 0; |
| 62 | 64 |
| 63 // Creates the appropriate surface depending on the GL implementation. | 65 // Creates the appropriate surface depending on the GL implementation. |
| 64 static scoped_refptr<gfx::GLSurface> | 66 static scoped_refptr<gfx::GLSurface> |
| 65 CreateSurface(GpuChannelManager* manager, | 67 CreateSurface(GpuChannelManager* manager, |
| 66 int32 render_view_id, | 68 int32 render_view_id, |
| 67 int32 renderer_id, | 69 int32 renderer_id, |
| 68 int32 command_buffer_id, | 70 int32 command_buffer_id, |
| 69 gfx::PluginWindowHandle handle); | 71 gfx::PluginWindowHandle handle); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 | 89 |
| 88 // IPC::Channel::Listener implementation: | 90 // IPC::Channel::Listener implementation: |
| 89 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 91 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 90 | 92 |
| 91 // Helper send functions. Caller fills in the surface specific params | 93 // Helper send functions. Caller fills in the surface specific params |
| 92 // like size and surface id. The helper fills in the rest. | 94 // like size and surface id. The helper fills in the rest. |
| 93 void SendAcceleratedSurfaceNew( | 95 void SendAcceleratedSurfaceNew( |
| 94 GpuHostMsg_AcceleratedSurfaceNew_Params params); | 96 GpuHostMsg_AcceleratedSurfaceNew_Params params); |
| 95 void SendAcceleratedSurfaceBuffersSwapped( | 97 void SendAcceleratedSurfaceBuffersSwapped( |
| 96 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 98 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 99 void SendAcceleratedSurfacePostSubBuffer( |
| 100 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 97 void SendAcceleratedSurfaceRelease( | 101 void SendAcceleratedSurfaceRelease( |
| 98 GpuHostMsg_AcceleratedSurfaceRelease_Params params); | 102 GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| 99 void SendResizeView(const gfx::Size& size); | 103 void SendResizeView(const gfx::Size& size); |
| 100 | 104 |
| 101 // Whether or not we should execute more commands. | 105 // Whether or not we should execute more commands. |
| 102 void SetScheduled(bool is_scheduled); | 106 void SetScheduled(bool is_scheduled); |
| 103 | 107 |
| 104 void DeferToFence(base::Closure task); | 108 void DeferToFence(base::Closure task); |
| 105 | 109 |
| 106 // Make the surface's context current. | 110 // Make the surface's context current. |
| 107 bool MakeCurrent(); | 111 bool MakeCurrent(); |
| 108 | 112 |
| 109 private: | 113 private: |
| 110 gpu::GpuScheduler* Scheduler(); | 114 gpu::GpuScheduler* Scheduler(); |
| 111 gpu::gles2::GLES2Decoder* Decoder(); | 115 gpu::gles2::GLES2Decoder* Decoder(); |
| 112 | 116 |
| 113 // IPC::Message handlers. | 117 // IPC::Message handlers. |
| 114 void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle); | 118 void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle); |
| 115 void OnBuffersSwappedACK(); | 119 void OnBuffersSwappedACK(); |
| 120 void OnPostSubBufferACK(); |
| 116 void OnResizeViewACK(); | 121 void OnResizeViewACK(); |
| 117 | 122 |
| 118 // Backbuffer resize callback. | 123 // Backbuffer resize callback. |
| 119 void Resize(gfx::Size size); | 124 void Resize(gfx::Size size); |
| 120 | 125 |
| 121 // Set the default swap interval on the surface. | 126 // Set the default swap interval on the surface. |
| 122 void SetSwapInterval(); | 127 void SetSwapInterval(); |
| 123 | 128 |
| 124 // Weak pointers that point to objects that outlive this helper. | 129 // Weak pointers that point to objects that outlive this helper. |
| 125 ImageTransportSurface* surface_; | 130 ImageTransportSurface* surface_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 148 virtual ~PassThroughImageTransportSurface(); | 153 virtual ~PassThroughImageTransportSurface(); |
| 149 | 154 |
| 150 // GLSurface implementation. | 155 // GLSurface implementation. |
| 151 virtual bool Initialize(); | 156 virtual bool Initialize(); |
| 152 virtual void Destroy(); | 157 virtual void Destroy(); |
| 153 | 158 |
| 154 // ImageTransportSurface implementation. | 159 // ImageTransportSurface implementation. |
| 155 virtual void OnNewSurfaceACK( | 160 virtual void OnNewSurfaceACK( |
| 156 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; | 161 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; |
| 157 virtual void OnBuffersSwappedACK() OVERRIDE; | 162 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 163 virtual void OnPostSubBufferACK() OVERRIDE; |
| 158 virtual void OnResizeViewACK() OVERRIDE; | 164 virtual void OnResizeViewACK() OVERRIDE; |
| 159 virtual void OnResize(gfx::Size size) OVERRIDE; | 165 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 160 | 166 |
| 161 private: | 167 private: |
| 162 scoped_ptr<ImageTransportHelper> helper_; | 168 scoped_ptr<ImageTransportHelper> helper_; |
| 163 | 169 |
| 164 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 170 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 165 }; | 171 }; |
| 166 | 172 |
| 167 #endif // defined(ENABLE_GPU) | 173 #endif // defined(ENABLE_GPU) |
| 168 | 174 |
| 169 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 175 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |