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