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