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