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_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_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 | 12 |
13 namespace content { | 13 namespace content { |
14 class CompositingIOSurfaceContext; | 14 class CompositingIOSurfaceContext; |
15 class RenderWidgetHostViewMac; | 15 class RenderWidgetHostViewMac; |
16 } | 16 } |
17 | 17 |
18 // The CoreAnimation layer for drawing accelerated content. | 18 // The CoreAnimation layer for drawing accelerated content. |
19 @interface CompositingIOSurfaceLayer : CAOpenGLLayer { | 19 @interface CompositingIOSurfaceLayer : CAOpenGLLayer { |
20 @private | 20 @private |
21 content::RenderWidgetHostViewMac* renderWidgetHostView_; | 21 content::RenderWidgetHostViewMac* renderWidgetHostView_; |
22 scoped_refptr<content::CompositingIOSurfaceContext> context_; | 22 scoped_refptr<content::CompositingIOSurfaceContext> context_; |
| 23 |
| 24 // Used to track when canDrawInCGLContext should return YES. This can be |
| 25 // in response to receiving a new compositor frame, or from any of the events |
| 26 // that cause setNeedsDisplay to be called on the layer. |
| 27 BOOL needsDisplay_; |
23 } | 28 } |
24 | 29 |
25 @property(nonatomic, readonly) | 30 @property(nonatomic, readonly) |
26 scoped_refptr<content::CompositingIOSurfaceContext> context; | 31 scoped_refptr<content::CompositingIOSurfaceContext> context; |
27 | 32 |
28 - (id)initWithRenderWidgetHostViewMac:(content::RenderWidgetHostViewMac*)r; | 33 - (id)initWithRenderWidgetHostViewMac:(content::RenderWidgetHostViewMac*)r; |
29 | 34 |
30 // Update the scale factor of the layer to match the scale factor of the | 35 // Update the scale factor of the layer to match the scale factor of the |
31 // IOSurface. | 36 // IOSurface. |
32 - (void)updateScaleFactor; | 37 - (void)updateScaleFactor; |
33 | 38 |
34 // Remove this layer from the layer heirarchy, and mark that | 39 // Remove this layer from the layer heirarchy, and mark that |
35 // |renderWidgetHostView_| is no longer valid and may no longer be dereferenced. | 40 // |renderWidgetHostView_| is no longer valid and may no longer be dereferenced. |
36 - (void)disableCompositing; | 41 - (void)disableCompositing; |
37 | 42 |
| 43 // Called when a new frame is received. |
| 44 - (void)gotNewFrame; |
| 45 |
| 46 // Called when it has been a while since a new frame has been received, and the |
| 47 // layer should become not-asynchronous. |
| 48 - (void)timerSinceGotNewFrameFired; |
| 49 |
38 @end | 50 @end |
39 | 51 |
40 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ | 52 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ |
OLD | NEW |