| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IOSURFACE_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_IOSURFACE_MAC_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_IOSURFACE_MAC_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_IOSURFACE_MAC_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "content/common/gpu/image_transport_surface_fbo_mac.h" | 10 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
| 11 | 11 |
| 12 // Note that this must be included after gl_bindings.h to avoid conflicts. | 12 // Note that this must be included after gl_bindings.h to avoid conflicts. |
| 13 #include <OpenGL/CGLIOSurface.h> | 13 #include <OpenGL/CGLIOSurface.h> |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // Allocate IOSurface-backed storage for an FBO image transport surface. | 17 // Allocate IOSurface-backed storage for an FBO image transport surface. |
| 18 class IOSurfaceStorageProvider | 18 class IOSurfaceStorageProvider |
| 19 : public ImageTransportSurfaceFBO::StorageProvider { | 19 : public ImageTransportSurfaceFBO::StorageProvider { |
| 20 public: | 20 public: |
| 21 IOSurfaceStorageProvider(ImageTransportSurfaceFBO* transport_surface); | 21 IOSurfaceStorageProvider(ImageTransportSurfaceFBO* transport_surface); |
| 22 ~IOSurfaceStorageProvider() override; | 22 ~IOSurfaceStorageProvider() override; |
| 23 | 23 |
| 24 // ImageTransportSurfaceFBO::StorageProvider implementation: | 24 // ImageTransportSurfaceFBO::StorageProvider implementation: |
| 25 gfx::Size GetRoundedSize(gfx::Size size) override; | 25 gfx::Size GetRoundedSize(gfx::Size size) override; |
| 26 bool AllocateColorBufferStorage( | 26 bool AllocateColorBufferStorage( |
| 27 CGLContextObj context, const base::Closure& context_dirtied_callback, | 27 CGLContextObj context, const base::Closure& context_dirtied_callback, |
| 28 GLuint texture, gfx::Size pixel_size, float scale_factor) override; | 28 GLuint texture, gfx::Size pixel_size, float scale_factor) override; |
| 29 void FreeColorBufferStorage() override; | 29 void FreeColorBufferStorage() override; |
| 30 void SwapBuffers(const gfx::Size& size, float scale_factor) override; | 30 void FrameSizeChanged( |
| 31 const gfx::Size& pixel_size, float scale_factor) override; |
| 32 void SwapBuffers() override; |
| 31 void WillWriteToBackbuffer() override; | 33 void WillWriteToBackbuffer() override; |
| 32 void DiscardBackbuffer() override; | 34 void DiscardBackbuffer() override; |
| 33 void SwapBuffersAckedByBrowser(bool disable_throttling) override; | 35 void SwapBuffersAckedByBrowser(bool disable_throttling) override; |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 ImageTransportSurfaceFBO* transport_surface_; | 38 ImageTransportSurfaceFBO* transport_surface_; |
| 37 | 39 |
| 38 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 40 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 41 gfx::Size frame_pixel_size_; |
| 42 float frame_scale_factor_; |
| 39 | 43 |
| 40 // The list of IOSurfaces that have been sent to the browser process but have | 44 // The list of IOSurfaces that have been sent to the browser process but have |
| 41 // not been opened in the browser process yet. This list should never have | 45 // not been opened in the browser process yet. This list should never have |
| 42 // more than one entry. | 46 // more than one entry. |
| 43 std::list<base::ScopedCFTypeRef<IOSurfaceRef>> pending_swapped_surfaces_; | 47 std::list<base::ScopedCFTypeRef<IOSurfaceRef>> pending_swapped_surfaces_; |
| 44 | 48 |
| 45 // The id of |io_surface_| or 0 if that's NULL. | 49 // The id of |io_surface_| or 0 if that's NULL. |
| 46 IOSurfaceID io_surface_id_; | 50 IOSurfaceID io_surface_id_; |
| 47 | 51 |
| 48 DISALLOW_COPY_AND_ASSIGN(IOSurfaceStorageProvider); | 52 DISALLOW_COPY_AND_ASSIGN(IOSurfaceStorageProvider); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace content | 55 } // namespace content |
| 52 | 56 |
| 53 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_IOSURFACE_MAC_H_ | 57 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_IOSURFACE_MAC_H_ |
| OLD | NEW |