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