| 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_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool SetIOSurface( | 51 bool SetIOSurface( |
| 52 IOSurfaceID io_surface_id, | 52 IOSurfaceID io_surface_id, |
| 53 const gfx::Size& pixel_size) WARN_UNUSED_RESULT; | 53 const gfx::Size& pixel_size) WARN_UNUSED_RESULT; |
| 54 | 54 |
| 55 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs, | 55 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs, |
| 56 // with the origin in the lower left corner. If the window rect's size is | 56 // with the origin in the lower left corner. If the window rect's size is |
| 57 // larger than the IOSurface, the remaining right and bottom edges will be | 57 // larger than the IOSurface, the remaining right and bottom edges will be |
| 58 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. | 58 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. |
| 59 bool DrawIOSurface() WARN_UNUSED_RESULT; | 59 bool DrawIOSurface() WARN_UNUSED_RESULT; |
| 60 | 60 |
| 61 // Returns the GL context in which this texture was created. | 61 // Returns true if the offscreen context used by this surface has been |
| 62 scoped_refptr<IOSurfaceContext> context() const { return context_; } | 62 // poisoned. |
| 63 bool HasBeenPoisoned() const; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 friend class base::RefCounted<IOSurfaceTexture>; | 66 friend class base::RefCounted<IOSurfaceTexture>; |
| 66 | 67 |
| 67 IOSurfaceTexture( | 68 IOSurfaceTexture( |
| 68 const scoped_refptr<IOSurfaceContext>& context); | 69 const scoped_refptr<IOSurfaceContext>& context); |
| 69 ~IOSurfaceTexture(); | 70 ~IOSurfaceTexture(); |
| 70 | 71 |
| 71 // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU | 72 // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU |
| 72 // process is no longer referencing it, this will delete the IOSurface. | 73 // process is no longer referencing it, this will delete the IOSurface. |
| 73 void ReleaseIOSurfaceAndTexture(); | 74 void ReleaseIOSurfaceAndTexture(); |
| 74 | 75 |
| 75 // Check for GL errors and store the result in error_. Only return new | 76 // Check for GL errors and store the result in error_. Only return new |
| 76 // errors | 77 // errors |
| 77 GLenum GetAndSaveGLError(); | 78 GLenum GetAndSaveGLError(); |
| 78 | 79 |
| 79 // Offscreen context used for all operations other than drawing to the | 80 // Offscreen context used for all operations other than drawing to the |
| 80 // screen. This is in the same share group as the contexts used for | 81 // screen. This is in the same share group as the contexts used for |
| 81 // drawing, and is the same for all IOSurfaces in all windows. | 82 // drawing, and is the same for all IOSurfaces in all windows. |
| 82 scoped_refptr<IOSurfaceContext> context_; | 83 scoped_refptr<IOSurfaceContext> offscreen_context_; |
| 83 | 84 |
| 84 // The IOSurface and its non-rounded size. | 85 // The IOSurface and its non-rounded size. |
| 85 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 86 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 86 gfx::Size pixel_size_; | 87 gfx::Size pixel_size_; |
| 87 | 88 |
| 88 // The "live" OpenGL texture referring to this IOSurfaceRef. Note | 89 // The "live" OpenGL texture referring to this IOSurfaceRef. Note |
| 89 // that per the CGLTexImageIOSurface2D API we do not need to | 90 // that per the CGLTexImageIOSurface2D API we do not need to |
| 90 // explicitly update this texture's contents once created. All we | 91 // explicitly update this texture's contents once created. All we |
| 91 // need to do is ensure it is re-bound before attempting to draw | 92 // need to do is ensure it is re-bound before attempting to draw |
| 92 // with it. | 93 // with it. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 112 | 113 |
| 113 static void EvictionScheduleDoEvict(); | 114 static void EvictionScheduleDoEvict(); |
| 114 static void EvictionDoEvict(); | 115 static void EvictionDoEvict(); |
| 115 static base::LazyInstance<EvictionQueue> eviction_queue_; | 116 static base::LazyInstance<EvictionQueue> eviction_queue_; |
| 116 static bool eviction_scheduled_; | 117 static bool eviction_scheduled_; |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace content | 120 } // namespace content |
| 120 | 121 |
| 121 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ | 122 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ |
| OLD | NEW |