OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // a lot like an onscreen surface to the GPU process. | 52 // a lot like an onscreen surface to the GPU process. |
53 // | 53 // |
54 // The ImageTransportSurfaceHelper provides some glue to the outside world: | 54 // The ImageTransportSurfaceHelper provides some glue to the outside world: |
55 // making sure outside events reach the ImageTransportSurface and | 55 // making sure outside events reach the ImageTransportSurface and |
56 // allowing the ImageTransportSurface to send events to the outside world. | 56 // allowing the ImageTransportSurface to send events to the outside world. |
57 | 57 |
58 class ImageTransportSurface { | 58 class ImageTransportSurface { |
59 public: | 59 public: |
60 ImageTransportSurface(); | 60 ImageTransportSurface(); |
61 | 61 |
62 virtual void OnNewSurfaceACK( | |
63 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | |
64 virtual void OnBufferPresented(uint32 sync_point) = 0; | 62 virtual void OnBufferPresented(uint32 sync_point) = 0; |
65 virtual void OnResizeViewACK() = 0; | 63 virtual void OnResizeViewACK() = 0; |
66 virtual void OnResize(gfx::Size size) = 0; | 64 virtual void OnResize(gfx::Size size) = 0; |
67 | 65 |
68 // Creates the appropriate surface depending on the GL implementation. | 66 // Creates the appropriate surface depending on the GL implementation. |
69 static scoped_refptr<gfx::GLSurface> | 67 static scoped_refptr<gfx::GLSurface> |
70 CreateSurface(GpuChannelManager* manager, | 68 CreateSurface(GpuChannelManager* manager, |
71 GpuCommandBufferStub* stub, | 69 GpuCommandBufferStub* stub, |
72 const gfx::GLSurfaceHandle& handle); | 70 const gfx::GLSurfaceHandle& handle); |
73 | 71 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 128 |
131 void Suspend(); | 129 void Suspend(); |
132 | 130 |
133 GpuChannelManager* manager() const { return manager_; } | 131 GpuChannelManager* manager() const { return manager_; } |
134 | 132 |
135 private: | 133 private: |
136 gpu::GpuScheduler* Scheduler(); | 134 gpu::GpuScheduler* Scheduler(); |
137 gpu::gles2::GLES2Decoder* Decoder(); | 135 gpu::gles2::GLES2Decoder* Decoder(); |
138 | 136 |
139 // IPC::Message handlers. | 137 // IPC::Message handlers. |
140 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); | |
141 void OnBufferPresented(uint32 sync_point); | 138 void OnBufferPresented(uint32 sync_point); |
142 void OnResizeViewACK(); | 139 void OnResizeViewACK(); |
143 | 140 |
144 // Backbuffer resize callback. | 141 // Backbuffer resize callback. |
145 void Resize(gfx::Size size); | 142 void Resize(gfx::Size size); |
146 | 143 |
147 // Weak pointers that point to objects that outlive this helper. | 144 // Weak pointers that point to objects that outlive this helper. |
148 ImageTransportSurface* surface_; | 145 ImageTransportSurface* surface_; |
149 GpuChannelManager* manager_; | 146 GpuChannelManager* manager_; |
150 | 147 |
(...skipping 16 matching lines...) Expand all Loading... |
167 bool transport); | 164 bool transport); |
168 | 165 |
169 // GLSurface implementation. | 166 // GLSurface implementation. |
170 virtual bool Initialize() OVERRIDE; | 167 virtual bool Initialize() OVERRIDE; |
171 virtual void Destroy() OVERRIDE; | 168 virtual void Destroy() OVERRIDE; |
172 virtual bool SwapBuffers() OVERRIDE; | 169 virtual bool SwapBuffers() OVERRIDE; |
173 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 170 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
174 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 171 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
175 | 172 |
176 // ImageTransportSurface implementation. | 173 // ImageTransportSurface implementation. |
177 virtual void OnNewSurfaceACK( | |
178 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | |
179 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; | 174 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; |
180 virtual void OnResizeViewACK() OVERRIDE; | 175 virtual void OnResizeViewACK() OVERRIDE; |
181 virtual void OnResize(gfx::Size size) OVERRIDE; | 176 virtual void OnResize(gfx::Size size) OVERRIDE; |
182 virtual gfx::Size GetSize() OVERRIDE; | 177 virtual gfx::Size GetSize() OVERRIDE; |
183 | 178 |
184 protected: | 179 protected: |
185 virtual ~PassThroughImageTransportSurface(); | 180 virtual ~PassThroughImageTransportSurface(); |
186 | 181 |
187 private: | 182 private: |
188 scoped_ptr<ImageTransportHelper> helper_; | 183 scoped_ptr<ImageTransportHelper> helper_; |
189 gfx::Size new_size_; | 184 gfx::Size new_size_; |
190 bool transport_; | 185 bool transport_; |
191 bool did_set_swap_interval_; | 186 bool did_set_swap_interval_; |
192 | 187 |
193 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 188 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
194 }; | 189 }; |
195 | 190 |
196 #endif // defined(ENABLE_GPU) | 191 #endif // defined(ENABLE_GPU) |
197 | 192 |
198 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 193 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |