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

Side by Side Diff: ui/accelerated_widget_mac/accelerated_widget_mac.h

Issue 2018793002: Mac: Move remote layer use to GpuOutputSurfaceMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean_up_mac
Patch Set: Created 4 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 UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ 5 #ifndef UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_
6 #define UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ 6 #define UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_
7 7
8 #include <IOSurface/IOSurface.h> 8 #include <IOSurface/IOSurface.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 // of an NSView. An AcceleratedWidget may be bound to multiple different views 37 // of an NSView. An AcceleratedWidget may be bound to multiple different views
38 // throughout its lifetime (one at a time, though). 38 // throughout its lifetime (one at a time, though).
39 class AcceleratedWidgetMacNSView { 39 class AcceleratedWidgetMacNSView {
40 public: 40 public:
41 virtual NSView* AcceleratedWidgetGetNSView() const = 0; 41 virtual NSView* AcceleratedWidgetGetNSView() const = 0;
42 virtual void AcceleratedWidgetGetVSyncParameters( 42 virtual void AcceleratedWidgetGetVSyncParameters(
43 base::TimeTicks* timebase, base::TimeDelta* interval) const = 0; 43 base::TimeTicks* timebase, base::TimeDelta* interval) const = 0;
44 virtual void AcceleratedWidgetSwapCompleted() = 0; 44 virtual void AcceleratedWidgetSwapCompleted() = 0;
45 }; 45 };
46 46
47 #if defined(__OBJC__) 47 #if defined(__OBJC__)
tapted 2016/05/27 00:33:19 With AcceleratedWidgetMacGotFrame(..) removed from
ccameron 2016/06/03 02:43:01 Yes!! (had to change a reference or two to be a fo
48 48
49 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed 49 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed
50 // to a ui::Compositor, which will cause, through its output surface, calls to 50 // to a ui::Compositor, which will cause, through its output surface, calls to
51 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed 51 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed
52 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper. 52 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper.
53 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac { 53 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac {
54 public: 54 public:
55 AcceleratedWidgetMac(); 55 AcceleratedWidgetMac();
56 virtual ~AcceleratedWidgetMac(); 56 virtual ~AcceleratedWidgetMac();
57 57
(...skipping 12 matching lines...) Expand all
70 // will return a conservative answer. 70 // will return a conservative answer.
71 bool MightBeInFullscreenLowPowerMode() const; 71 bool MightBeInFullscreenLowPowerMode() const;
72 72
73 // Return true if the last frame swapped has a size in DIP of |dip_size|. 73 // Return true if the last frame swapped has a size in DIP of |dip_size|.
74 bool HasFrameOfSize(const gfx::Size& dip_size) const; 74 bool HasFrameOfSize(const gfx::Size& dip_size) const;
75 75
76 // Populate the vsync parameters for the surface's display. 76 // Populate the vsync parameters for the surface's display.
77 void GetVSyncParameters( 77 void GetVSyncParameters(
78 base::TimeTicks* timebase, base::TimeDelta* interval) const; 78 base::TimeTicks* timebase, base::TimeDelta* interval) const;
79 79
80 void GotFrame(CAContextID ca_context_id, 80 static AcceleratedWidgetMac* Get(gfx::AcceleratedWidget widget);
81 bool fullscreen_low_power_ca_context_valid, 81 void GotCALayerFrame(
82 CAContextID fullscreen_low_power_ca_context_id, 82 base::scoped_nsobject<CALayer> content_layer,
83 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 83 bool fullscreen_low_power_layer_valid,
84 const gfx::Size& pixel_size, 84 base::scoped_nsobject<CALayer> fullscreen_low_power_layer,
85 float scale_factor); 85 const gfx::Size& pixel_size,
86 86 float scale_factor);
87 private:
88 void GotCAContextFrame(CAContextID ca_context_id,
89 bool fullscreen_low_power_ca_context_valid,
90 CAContextID fullscreen_low_power_ca_context_id,
91 const gfx::Size& pixel_size,
92 float scale_factor);
93
94 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 87 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
95 const gfx::Size& pixel_size, 88 const gfx::Size& pixel_size,
96 float scale_factor); 89 float scale_factor);
97 90
98 // Remove a layer from the heirarchy and destroy it. Because the accelerated 91 private:
99 // layer types may be replaced by a layer of the same type, the layer to
100 // destroy is parameterized, and, if it is the current layer, the current
101 // layer is reset.
102 void DestroyCAContextLayer(
103 base::scoped_nsobject<CALayerHost> ca_context_layer);
104 void DestroyLocalLayer();
105 void EnsureLocalLayer();
106
107 // The AcceleratedWidgetMacNSView that is using this as its internals. 92 // The AcceleratedWidgetMacNSView that is using this as its internals.
108 AcceleratedWidgetMacNSView* view_; 93 AcceleratedWidgetMacNSView* view_;
109 94
110 // A phony NSView handle used to identify this. 95 // A phony NSView handle used to identify this.
111 gfx::AcceleratedWidget native_widget_; 96 gfx::AcceleratedWidget native_widget_;
112 97
113 // The fullscreen low power coordinator. Weak, reset by 98 // The fullscreen low power coordinator. Weak, reset by
114 // SetFullscreenLowPowerCoordinator when it is destroyed. 99 // SetFullscreenLowPowerCoordinator when it is destroyed.
115 FullscreenLowPowerCoordinator* fslp_coordinator_ = nullptr; 100 FullscreenLowPowerCoordinator* fslp_coordinator_ = nullptr;
116 101
117 // A flipped layer, which acts as the parent of the compositing and software 102 // A flipped layer, which acts as the parent of the compositing and software
118 // layers. This layer is flipped so that the we don't need to recompute the 103 // layers. This layer is flipped so that the we don't need to recompute the
119 // origin for sub-layers when their position changes (this is impossible when 104 // origin for sub-layers when their position changes (this is impossible when
120 // using remote layers, as their size change cannot be synchronized with the 105 // using remote layers, as their size change cannot be synchronized with the
121 // window). This indirection is needed because flipping hosted layers (like 106 // window). This indirection is needed because flipping hosted layers (like
122 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable 107 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable
123 // behavior. 108 // behavior.
124 base::scoped_nsobject<CALayer> flipped_layer_; 109 base::scoped_nsobject<CALayer> flipped_layer_;
125 110
126 // The accelerated CoreAnimation layers hosted by the GPU process. 111 // A CALayer with content provided by the output surface.
127 base::scoped_nsobject<CALayerHost> ca_context_layer_; 112 base::scoped_nsobject<CALayer> content_layer_;
128 base::scoped_nsobject<CALayerHost> fullscreen_low_power_layer_; 113 base::scoped_nsobject<CALayer> fullscreen_low_power_layer_;
129 114
130 // The locally drawn layer, which has its contents set to an IOSurface. 115 // A CALayer that has its content set to an IOSurface.
131 base::scoped_nsobject<CALayer> local_layer_; 116 base::scoped_nsobject<CALayer> io_surface_layer_;
132 117
133 // The size in DIP of the last swap received from |compositor_|. 118 // The size in DIP of the last swap received from |compositor_|.
134 gfx::Size last_swap_size_dip_; 119 gfx::Size last_swap_size_dip_;
135 120
136 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac); 121 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac);
137 }; 122 };
138 123
139 #endif // __OBJC__ 124 #endif // __OBJC__
140 125
141 ACCELERATED_WIDGET_MAC_EXPORT
142 void AcceleratedWidgetMacGotFrame(
143 gfx::AcceleratedWidget widget,
144 CAContextID ca_context_id,
145 bool fullscreen_low_power_ca_context_valid,
146 CAContextID fullscreen_low_power_ca_context_id,
147 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
148 const gfx::Size& pixel_size,
149 float scale_factor,
150 base::TimeTicks* vsync_timebase,
151 base::TimeDelta* vsync_interval);
152
153 } // namespace ui 126 } // namespace ui
154 127
155 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ 128 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698