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> |
| 9 |
8 #include "content/common/gpu/image_transport_surface_fbo_mac.h" | 10 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
9 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
10 | 12 |
11 // Note that this must be included after gl_bindings.h to avoid conflicts. | 13 // Note that this must be included after gl_bindings.h to avoid conflicts. |
12 #include <OpenGL/CGLIOSurface.h> | 14 #include <OpenGL/CGLIOSurface.h> |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 | 17 |
16 // Allocate IOSurface-backed storage for an FBO image transport surface. | 18 // Allocate IOSurface-backed storage for an FBO image transport surface. |
17 class IOSurfaceStorageProvider | 19 class IOSurfaceStorageProvider |
18 : public ImageTransportSurfaceFBO::StorageProvider { | 20 : public ImageTransportSurfaceFBO::StorageProvider { |
19 public: | 21 public: |
20 IOSurfaceStorageProvider(); | 22 IOSurfaceStorageProvider(ImageTransportSurfaceFBO* transport_surface); |
21 virtual ~IOSurfaceStorageProvider(); | 23 virtual ~IOSurfaceStorageProvider(); |
22 | 24 |
23 // ImageTransportSurfaceFBO::StorageProvider implementation: | 25 // ImageTransportSurfaceFBO::StorageProvider implementation: |
24 virtual gfx::Size GetRoundedSize(gfx::Size size) OVERRIDE; | 26 virtual gfx::Size GetRoundedSize(gfx::Size size) OVERRIDE; |
25 virtual bool AllocateColorBufferStorage( | 27 virtual bool AllocateColorBufferStorage( |
26 CGLContextObj context, GLuint texture, | 28 CGLContextObj context, GLuint texture, |
27 gfx::Size pixel_size, float scale_factor) OVERRIDE; | 29 gfx::Size pixel_size, float scale_factor) OVERRIDE; |
28 virtual void FreeColorBufferStorage() OVERRIDE; | 30 virtual void FreeColorBufferStorage() OVERRIDE; |
29 virtual uint64 GetSurfaceHandle() const OVERRIDE; | 31 virtual uint64 GetSurfaceHandle() const OVERRIDE; |
30 virtual void WillSwapBuffers() OVERRIDE; | 32 virtual void WillSwapBuffers() OVERRIDE; |
| 33 virtual void CanFreeSwappedBuffer() OVERRIDE; |
31 | 34 |
32 private: | 35 private: |
| 36 ImageTransportSurfaceFBO* transport_surface_; |
| 37 |
33 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 38 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
34 | 39 |
| 40 // 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 |
| 42 // more than one entry. |
| 43 std::list<base::ScopedCFTypeRef<IOSurfaceRef>> pending_swapped_surfaces_; |
| 44 |
35 // The id of |io_surface_| or 0 if that's NULL. | 45 // The id of |io_surface_| or 0 if that's NULL. |
36 IOSurfaceID io_surface_id_; | 46 IOSurfaceID io_surface_id_; |
37 | 47 |
38 DISALLOW_COPY_AND_ASSIGN(IOSurfaceStorageProvider); | 48 DISALLOW_COPY_AND_ASSIGN(IOSurfaceStorageProvider); |
39 }; | 49 }; |
40 | 50 |
41 } // namespace content | 51 } // namespace content |
42 | 52 |
43 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ | 53 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ |
OLD | NEW |