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

Side by Side Diff: content/browser/compositor/browser_compositor_view_mac.h

Issue 316103004: Mac ÜC: Enable GPU back-pressure from the browser to the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dip
Patch Set: Simplify Created 6 years, 6 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 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_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "cc/output/software_frame_data.h" 11 #include "cc/output/software_frame_data.h"
12 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" 12 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h"
13 #include "content/browser/renderer_host/software_layer_mac.h" 13 #include "content/browser/renderer_host/software_layer_mac.h"
14 #include "skia/ext/platform_canvas.h" 14 #include "skia/ext/platform_canvas.h"
15 #include "ui/compositor/compositor.h" 15 #include "ui/compositor/compositor.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 17
18 @class BrowserCompositorViewMac; 18 namespace content {
19 class BrowserCompositorViewMacHelper;
20
21 class BrowserCompositorViewMacClient {
22 public:
23 virtual void BrowserCompositorDidDrawFrame() = 0;
24 };
25
26 } // namespace content
19 27
20 // Additions to the NSView interface for compositor frames. 28 // Additions to the NSView interface for compositor frames.
21 @interface NSView (BrowserCompositorView) 29 @interface NSView (BrowserCompositorView)
22 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle 30 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle
23 withPixelSize:(gfx::Size)pixel_size 31 withPixelSize:(gfx::Size)pixel_size
24 withScaleFactor:(float)scale_factor; 32 withScaleFactor:(float)scale_factor;
25 33
26 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data 34 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data
27 withScaleFactor:(float)scale_factor 35 withScaleFactor:(float)scale_factor
28 withCanvas:(SkCanvas*)canvas; 36 withCanvas:(SkCanvas*)canvas;
29 @end 37 @end // NSView (BrowserCompositorView)
30 38
31 // NSView drawn by a ui::Compositor. The superview of this view is responsible 39 // NSView drawn by a ui::Compositor. The superview of this view is responsible
32 // for changing the ui::Compositor SizeAndScale and calling layoutLayers when 40 // for changing the ui::Compositor SizeAndScale and calling layoutLayers when
33 // the size of the parent view may change. This interface is patterned after 41 // the size of the parent view may change. This interface is patterned after
34 // the needs of RenderWidgetHostViewCocoa, and could change. 42 // the needs of RenderWidgetHostViewCocoa, and could change.
35 @interface BrowserCompositorViewMac : NSView { 43 @interface BrowserCompositorViewMac : NSView {
36 scoped_ptr<ui::Compositor> compositor_; 44 scoped_ptr<ui::Compositor> compositor_;
45
37 base::scoped_nsobject<CALayer> background_layer_; 46 base::scoped_nsobject<CALayer> background_layer_;
38 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_; 47 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_;
39 base::scoped_nsobject<SoftwareLayer> software_layer_; 48 base::scoped_nsobject<SoftwareLayer> software_layer_;
49
50 content::BrowserCompositorViewMacClient* client_;
51 scoped_ptr<content::BrowserCompositorViewMacHelper> helper_;
40 } 52 }
41 53
42 // Initialize to render the content of a specific superview. 54 // Initialize to render the content of a specific superview.
43 - (id)initWithSuperview:(NSView*)view; 55 - (id)initWithSuperview:(NSView*)view
56 withClient:(content::BrowserCompositorViewMacClient*)client;
44 57
45 // Re-position the layers to the correct place when this view's superview 58 // Re-position the layers to the correct place when this view's superview
46 // changes size, or when the accelerated or software content changes. 59 // changes size, or when the accelerated or software content changes.
47 - (void)layoutLayers; 60 - (void)layoutLayers;
48 61
62 // Disallow further access to the client.
63 - (void)resetClient;
64
49 // Access the underlying ui::Compositor for this view. 65 // Access the underlying ui::Compositor for this view.
50 - (ui::Compositor*)compositor; 66 - (ui::Compositor*)compositor;
51 @end 67 @end // BrowserCompositorViewMac
52 68
53 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ 69 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698