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