OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LAYER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 | 14 |
15 @class IOSurfaceLayer; | 15 @class IOSurfaceLayer; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class IOSurfaceTexture; | 18 class IOSurfaceTexture; |
| 19 class IOSurfaceContext; |
19 | 20 |
20 // The interface through which the IOSurfaceLayer calls back into | 21 // The interface through which the IOSurfaceLayer calls back into |
21 // the structrue that created it (RenderWidgetHostViewMac or | 22 // the structrue that created it (RenderWidgetHostViewMac or |
22 // BrowserCompositorViewMac). | 23 // BrowserCompositorViewMac). |
23 class IOSurfaceLayerClient { | 24 class IOSurfaceLayerClient { |
24 public: | 25 public: |
25 // Used to indicate that the layer should attempt to draw immediately and | 26 // Used to indicate that the layer should attempt to draw immediately and |
26 // should (even if the draw is elided by the system), ack the frame | 27 // should (even if the draw is elided by the system), ack the frame |
27 // immediately. | 28 // immediately. |
28 virtual bool IOSurfaceLayerShouldAckImmediately() const = 0; | 29 virtual bool IOSurfaceLayerShouldAckImmediately() const = 0; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // acknowledging the frame after timeout of 1/6th of a second has passed. | 110 // acknowledging the frame after timeout of 1/6th of a second has passed. |
110 base::DelayTimer<IOSurfaceLayerHelper> timer_; | 111 base::DelayTimer<IOSurfaceLayerHelper> timer_; |
111 }; | 112 }; |
112 | 113 |
113 } // namespace content | 114 } // namespace content |
114 | 115 |
115 // The CoreAnimation layer for drawing accelerated content. | 116 // The CoreAnimation layer for drawing accelerated content. |
116 @interface IOSurfaceLayer : CAOpenGLLayer { | 117 @interface IOSurfaceLayer : CAOpenGLLayer { |
117 @private | 118 @private |
118 scoped_refptr<content::IOSurfaceTexture> iosurface_; | 119 scoped_refptr<content::IOSurfaceTexture> iosurface_; |
| 120 scoped_refptr<content::IOSurfaceContext> context_; |
| 121 |
119 scoped_ptr<content::IOSurfaceLayerHelper> helper_; | 122 scoped_ptr<content::IOSurfaceLayerHelper> helper_; |
120 } | 123 } |
121 | 124 |
122 - (id)initWithClient:(content::IOSurfaceLayerClient*)client | 125 - (id)initWithClient:(content::IOSurfaceLayerClient*)client |
123 withScaleFactor:(float)scale_factor; | 126 withScaleFactor:(float)scale_factor; |
124 | 127 |
125 - (bool)gotFrameWithIOSurface:(IOSurfaceID)io_surface_id | 128 - (bool)gotFrameWithIOSurface:(IOSurfaceID)io_surface_id |
126 withPixelSize:(gfx::Size)pixel_size | 129 withPixelSize:(gfx::Size)pixel_size |
127 withScaleFactor:(float)scale_factor; | 130 withScaleFactor:(float)scale_factor; |
128 | 131 |
(...skipping 20 matching lines...) Expand all Loading... |
149 // Force a draw immediately, but only if one was requested. | 152 // Force a draw immediately, but only if one was requested. |
150 - (void)displayIfNeededAndAck; | 153 - (void)displayIfNeededAndAck; |
151 | 154 |
152 // Mark a bracket in which new frames are being pumped in a restricted nested | 155 // Mark a bracket in which new frames are being pumped in a restricted nested |
153 // run loop. | 156 // run loop. |
154 - (void)beginPumpingFrames; | 157 - (void)beginPumpingFrames; |
155 - (void)endPumpingFrames; | 158 - (void)endPumpingFrames; |
156 @end | 159 @end |
157 | 160 |
158 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ | 161 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ |
OLD | NEW |