Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_layer_mac.h

Issue 294023012: Use a separate NSView to draw browser composited content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments, clean-u Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CompositingIOSurfaceMac;
14 class CompositingIOSurfaceContext; 15 class CompositingIOSurfaceContext;
15 class RenderWidgetHostViewMac; 16
17 class CompositingIOSurfaceLayerClient {
18 public:
19 virtual void AcceleratedLayerDidDrawFrame(bool succeeded) = 0;
20 virtual bool AcceleratedLayerHasNotAckedPendingFrame() const = 0;
21 };
22
16 } 23 }
17 24
18 // The CoreAnimation layer for drawing accelerated content. 25 // The CoreAnimation layer for drawing accelerated content.
19 @interface CompositingIOSurfaceLayer : CAOpenGLLayer { 26 @interface CompositingIOSurfaceLayer : CAOpenGLLayer {
20 @private 27 @private
21 content::RenderWidgetHostViewMac* renderWidgetHostView_; 28 content::CompositingIOSurfaceLayerClient* client_;
29 scoped_refptr<content::CompositingIOSurfaceMac> iosurface_;
22 scoped_refptr<content::CompositingIOSurfaceContext> context_; 30 scoped_refptr<content::CompositingIOSurfaceContext> context_;
23 31
24 // Used to track when canDrawInCGLContext should return YES. This can be 32 // 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 33 // in response to receiving a new compositor frame, or from any of the events
26 // that cause setNeedsDisplay to be called on the layer. 34 // that cause setNeedsDisplay to be called on the layer.
27 BOOL needsDisplay_; 35 BOOL needs_display_;
36
37 // Incremented every time that this layer is asked to draw but does not have
38 // new content to draw.
39 uint64 did_not_draw_counter_;
28 } 40 }
29 41
30 - (id)initWithRenderWidgetHostViewMac:(content::RenderWidgetHostViewMac*)r; 42 - (content::CompositingIOSurfaceMac*)iosurface;
43 - (content::CompositingIOSurfaceContext*)context;
31 44
32 // Remove this layer from the layer heirarchy, and mark that 45 - (id)initWithIOSurface:(scoped_refptr<content::CompositingIOSurfaceMac>)
33 // |renderWidgetHostView_| is no longer valid and may no longer be dereferenced. 46 iosurface
34 - (void)disableCompositing; 47 withClient:(content::CompositingIOSurfaceLayerClient*)client;
48
49 // Mark that the client is no longer valid and cannot be called back into.
50 - (void)resetClient;
35 51
36 // Called when a new frame is received. 52 // Called when a new frame is received.
37 - (void)gotNewFrame; 53 - (void)gotNewFrame;
38 54
39 // Called when it has been a while since a new frame has been received, and the
40 // layer should become not-asynchronous.
41 - (void)timerSinceGotNewFrameFired;
42
43 @end 55 @end
44 56
45 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ 57 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698