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(uint64 surface_handle, 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, |
| 67 uint32 protection_state_id); |
66 | 68 |
67 // Creates the appropriate surface depending on the GL implementation. | 69 // Creates the appropriate surface depending on the GL implementation. |
68 static scoped_refptr<gfx::GLSurface> | 70 static scoped_refptr<gfx::GLSurface> |
69 CreateSurface(GpuChannelManager* manager, | 71 CreateSurface(GpuChannelManager* manager, |
70 GpuCommandBufferStub* stub, | 72 GpuCommandBufferStub* stub, |
71 const gfx::GLSurfaceHandle& handle); | 73 const gfx::GLSurfaceHandle& handle); |
72 | 74 |
73 virtual gfx::Size GetSize() = 0; | 75 virtual gfx::Size GetSize() = 0; |
74 | 76 |
75 protected: | 77 protected: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 void Suspend(); | 136 void Suspend(); |
135 | 137 |
136 GpuChannelManager* manager() const { return manager_; } | 138 GpuChannelManager* manager() const { return manager_; } |
137 GpuCommandBufferStub* stub() const { return stub_.get(); } | 139 GpuCommandBufferStub* stub() const { return stub_.get(); } |
138 | 140 |
139 private: | 141 private: |
140 gpu::GpuScheduler* Scheduler(); | 142 gpu::GpuScheduler* Scheduler(); |
141 gpu::gles2::GLES2Decoder* Decoder(); | 143 gpu::gles2::GLES2Decoder* Decoder(); |
142 | 144 |
143 // IPC::Message handlers. | 145 // IPC::Message handlers. |
144 void OnBufferPresented(uint64 surface_handle, uint32 sync_point); | 146 void OnBufferPresented(bool presented, uint32 sync_point); |
145 void OnResizeViewACK(); | 147 void OnResizeViewACK(); |
| 148 void OnSetFrontSurfaceIsProtected(bool is_protected, |
| 149 uint32 protection_state_id); |
146 | 150 |
147 // Backbuffer resize callback. | 151 // Backbuffer resize callback. |
148 void Resize(gfx::Size size); | 152 void Resize(gfx::Size size); |
149 | 153 |
150 // Weak pointers that point to objects that outlive this helper. | 154 // Weak pointers that point to objects that outlive this helper. |
151 ImageTransportSurface* surface_; | 155 ImageTransportSurface* surface_; |
152 GpuChannelManager* manager_; | 156 GpuChannelManager* manager_; |
153 | 157 |
154 base::WeakPtr<GpuCommandBufferStub> stub_; | 158 base::WeakPtr<GpuCommandBufferStub> stub_; |
155 int32 route_id_; | 159 int32 route_id_; |
(...skipping 14 matching lines...) Expand all Loading... |
170 bool transport); | 174 bool transport); |
171 | 175 |
172 // GLSurface implementation. | 176 // GLSurface implementation. |
173 virtual bool Initialize() OVERRIDE; | 177 virtual bool Initialize() OVERRIDE; |
174 virtual void Destroy() OVERRIDE; | 178 virtual void Destroy() OVERRIDE; |
175 virtual bool SwapBuffers() OVERRIDE; | 179 virtual bool SwapBuffers() OVERRIDE; |
176 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 180 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
177 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 181 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
178 | 182 |
179 // ImageTransportSurface implementation. | 183 // ImageTransportSurface implementation. |
180 virtual void OnBufferPresented(uint64 surface_handle, | 184 virtual void OnBufferPresented(bool presented, |
181 uint32 sync_point) OVERRIDE; | 185 uint32 sync_point) OVERRIDE; |
182 virtual void OnResizeViewACK() OVERRIDE; | 186 virtual void OnResizeViewACK() OVERRIDE; |
183 virtual void OnResize(gfx::Size size) OVERRIDE; | 187 virtual void OnResize(gfx::Size size) OVERRIDE; |
184 virtual gfx::Size GetSize() OVERRIDE; | 188 virtual gfx::Size GetSize() OVERRIDE; |
185 | 189 |
186 protected: | 190 protected: |
187 virtual ~PassThroughImageTransportSurface(); | 191 virtual ~PassThroughImageTransportSurface(); |
188 | 192 |
189 // If updated vsync parameters can be determined, send this information to | 193 // If updated vsync parameters can be determined, send this information to |
190 // the browser. | 194 // the browser. |
191 virtual void SendVSyncUpdateIfAvailable(); | 195 virtual void SendVSyncUpdateIfAvailable(); |
192 | 196 |
193 private: | 197 private: |
194 scoped_ptr<ImageTransportHelper> helper_; | 198 scoped_ptr<ImageTransportHelper> helper_; |
195 gfx::Size new_size_; | 199 gfx::Size new_size_; |
196 bool transport_; | 200 bool transport_; |
197 bool did_set_swap_interval_; | 201 bool did_set_swap_interval_; |
198 | 202 |
199 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 203 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
200 }; | 204 }; |
201 | 205 |
202 } // namespace content | 206 } // namespace content |
203 | 207 |
204 #endif // defined(ENABLE_GPU) | 208 #endif // defined(ENABLE_GPU) |
205 | 209 |
206 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 210 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |