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

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

Issue 283053002: Add compositing, layers to app_list_demo Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master -- probably slightly broken Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/app_list/demo/app_list_demo_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 8 #include <vector>
9 9
10 #include "cc/output/software_frame_data.h" 10 #include "cc/output/software_frame_data.h"
11 #include "skia/ext/platform_canvas.h" 11 #include "skia/ext/platform_canvas.h"
12 #include "ui/compositor/compositor.h" 12 #include "ui/compositor/compositor.h"
13 #include "ui/events/latency_info.h" 13 #include "ui/events/latency_info.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 15
16 #include "content/common/content_export.h"
17
18 // Additions to the NSView interface for compositor frames.
19 @interface NSView (BrowserCompositorView)
20 - (void)gotAcceleratedIOSurfaceFrame:(IOSurfaceID)surface_handle
21 withOutputSurfaceID:(int)surface_id
22 withLatencyInfo:(std::vector<ui::LatencyInfo>) latency_info
23 withPixelSize:(gfx::Size)pixel_size
24 withScaleFactor:(float)scale_factor;
25
26 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data
27 withScaleFactor:(float)scale_factor
28 withCanvas:(SkCanvas*)canvas;
29 @end // NSView (BrowserCompositorView)
30
16 namespace content { 31 namespace content {
17 32
18 class BrowserCompositorViewMacInternal; 33 class BrowserCompositorViewMacInternal;
19 34
20 // The interface through which BrowserCompositorViewMac calls back into 35 // The interface through which BrowserCompositorViewMac calls back into
21 // RenderWidgetHostViewMac (or any other structure that wishes to draw a 36 // RenderWidgetHostViewMac (or any other structure that wishes to draw a
22 // NSView backed by a ui::Compositor). 37 // NSView backed by a ui::Compositor).
23 class BrowserCompositorViewMacClient { 38 class CONTENT_EXPORT BrowserCompositorViewMacClient {
24 public: 39 public:
25 // Drawing is usually throttled by the rate at which CoreAnimation draws 40 // Drawing is usually throttled by the rate at which CoreAnimation draws
26 // frames to the screen. This can be used to disable throttling. 41 // frames to the screen. This can be used to disable throttling.
27 virtual bool BrowserCompositorViewShouldAckImmediately() const = 0; 42 virtual bool BrowserCompositorViewShouldAckImmediately() const = 0;
28 43
29 // Called when a frame is drawn, and used to pass latency info back to the 44 // Called when a frame is drawn, and used to pass latency info back to the
30 // renderer (if any). 45 // renderer (if any).
31 virtual void BrowserCompositorViewFrameSwapped( 46 virtual void BrowserCompositorViewFrameSwapped(
32 const std::vector<ui::LatencyInfo>& latency_info) = 0; 47 const std::vector<ui::LatencyInfo>& latency_info) = 0;
33 48
34 // Used to install the ui::Compositor-backed NSView as a child of its parent 49 // Used to install the ui::Compositor-backed NSView as a child of its parent
35 // view. 50 // view.
36 virtual NSView* BrowserCompositorSuperview() = 0; 51 virtual NSView* BrowserCompositorSuperview() = 0;
37 52
38 // Used to install the root ui::Layer into the ui::Compositor. 53 // Used to install the root ui::Layer into the ui::Compositor.
39 virtual ui::Layer* BrowserCompositorRootLayer() = 0; 54 virtual ui::Layer* BrowserCompositorRootLayer() = 0;
40 }; 55 };
41 56
42 // The class to hold a ui::Compositor-backed NSView. Because a ui::Compositor 57 // The class to hold a ui::Compositor-backed NSView. Because a ui::Compositor
43 // is expensive in terms of resources and re-allocating a ui::Compositor is 58 // is expensive in terms of resources and re-allocating a ui::Compositor is
44 // expensive in terms of work, this class is largely used to manage recycled 59 // expensive in terms of work, this class is largely used to manage recycled
45 // instances of BrowserCompositorViewCocoa, which actually is a NSView and 60 // instances of BrowserCompositorViewCocoa, which actually is a NSView and
46 // has a ui::Compositor instance. 61 // has a ui::Compositor instance.
47 class BrowserCompositorViewMac { 62 class CONTENT_EXPORT BrowserCompositorViewMac {
48 public: 63 public:
49 // This will install the NSView which is drawn by the ui::Compositor into 64 // This will install the NSView which is drawn by the ui::Compositor into
50 // the NSView provided by the client. 65 // the NSView provided by the client.
51 explicit BrowserCompositorViewMac(BrowserCompositorViewMacClient* client); 66 explicit BrowserCompositorViewMac(BrowserCompositorViewMacClient* client);
52 ~BrowserCompositorViewMac(); 67 ~BrowserCompositorViewMac();
53 68
54 // The ui::Compositor being used to render the NSView. 69 // The ui::Compositor being used to render the NSView.
55 ui::Compositor* GetCompositor() const; 70 ui::Compositor* GetCompositor() const;
56 71
57 // The client (used by the BrowserCompositorViewCocoa to access the client). 72 // The client (used by the BrowserCompositorViewCocoa to access the client).
(...skipping 21 matching lines...) Expand all
79 94
80 private: 95 private:
81 BrowserCompositorViewMacClient* client_; 96 BrowserCompositorViewMacClient* client_;
82 scoped_ptr<BrowserCompositorViewMacInternal> internal_view_; 97 scoped_ptr<BrowserCompositorViewMacInternal> internal_view_;
83 }; 98 };
84 99
85 // A class to keep around whenever a BrowserCompositorViewMac may be created. 100 // A class to keep around whenever a BrowserCompositorViewMac may be created.
86 // While at least one instance of this class exists, a spare 101 // While at least one instance of this class exists, a spare
87 // BrowserCompositorViewCocoa will be kept around to be recycled so that the 102 // BrowserCompositorViewCocoa will be kept around to be recycled so that the
88 // next BrowserCompositorViewMac to be created will be be created quickly. 103 // next BrowserCompositorViewMac to be created will be be created quickly.
89 class BrowserCompositorViewPlaceholderMac { 104 class CONTENT_EXPORT BrowserCompositorViewPlaceholderMac {
90 public: 105 public:
91 BrowserCompositorViewPlaceholderMac(); 106 BrowserCompositorViewPlaceholderMac();
92 ~BrowserCompositorViewPlaceholderMac(); 107 ~BrowserCompositorViewPlaceholderMac();
93 }; 108 };
94 109
95 } // namespace content 110 } // namespace content
96 111
97 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ 112 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/app_list/demo/app_list_demo_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698