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

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

Issue 1952163002: Mac fullscreen low power video: Add FullscreenLowPowerControllerCocoa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumb_widget
Patch Set: Rebase Created 4 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 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 13 matching lines...) Expand all
24 24
25 class SkCanvas; 25 class SkCanvas;
26 26
27 namespace cc { 27 namespace cc {
28 class SoftwareFrameData; 28 class SoftwareFrameData;
29 } 29 }
30 30
31 namespace ui { 31 namespace ui {
32 32
33 class AcceleratedWidgetMac; 33 class AcceleratedWidgetMac;
34 class FullscreenLowPowerCoordinator;
34 35
35 // A class through which an AcceleratedWidget may be bound to draw the contents 36 // A class through which an AcceleratedWidget may be bound to draw the contents
36 // 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
37 // throughout its lifetime (one at a time, though). 38 // throughout its lifetime (one at a time, though).
38 class AcceleratedWidgetMacNSView { 39 class AcceleratedWidgetMacNSView {
39 public: 40 public:
40 virtual NSView* AcceleratedWidgetGetNSView() const = 0; 41 virtual NSView* AcceleratedWidgetGetNSView() const = 0;
41 virtual void AcceleratedWidgetGetVSyncParameters( 42 virtual void AcceleratedWidgetGetVSyncParameters(
42 base::TimeTicks* timebase, base::TimeDelta* interval) const = 0; 43 base::TimeTicks* timebase, base::TimeDelta* interval) const = 0;
43 virtual void AcceleratedWidgetSwapCompleted() = 0; 44 virtual void AcceleratedWidgetSwapCompleted() = 0;
44 }; 45 };
45 46
46 #if defined(__OBJC__) 47 #if defined(__OBJC__)
47 48
48 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed 49 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed
49 // 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
50 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed 51 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed
51 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper. 52 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper.
52 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac { 53 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac {
53 public: 54 public:
54 AcceleratedWidgetMac(); 55 AcceleratedWidgetMac();
55 virtual ~AcceleratedWidgetMac(); 56 virtual ~AcceleratedWidgetMac();
56 57
57 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; } 58 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; }
58 59
59 void SetNSView(AcceleratedWidgetMacNSView* view); 60 void SetNSView(AcceleratedWidgetMacNSView* view);
60 void ResetNSView(); 61 void ResetNSView();
61 62
63 // Fullscreen low power mode interface.
64 void SetFullscreenLowPowerCoordinator(
65 FullscreenLowPowerCoordinator* coordinator);
66 void ResetFullscreenLowPowerCoordinator();
67 CALayer* GetFullscreenLowPowerLayer() const;
68
62 // Return true if the last frame swapped has a size in DIP of |dip_size|. 69 // Return true if the last frame swapped has a size in DIP of |dip_size|.
63 bool HasFrameOfSize(const gfx::Size& dip_size) const; 70 bool HasFrameOfSize(const gfx::Size& dip_size) const;
64 71
65 // Populate the vsync parameters for the surface's display. 72 // Populate the vsync parameters for the surface's display.
66 void GetVSyncParameters( 73 void GetVSyncParameters(
67 base::TimeTicks* timebase, base::TimeDelta* interval) const; 74 base::TimeTicks* timebase, base::TimeDelta* interval) const;
68 75
69 void GotFrame(CAContextID ca_context_id, 76 void GotFrame(CAContextID ca_context_id,
70 bool fullscreen_low_power_ca_context_valid, 77 bool fullscreen_low_power_ca_context_valid,
71 CAContextID fullscreen_low_power_ca_context_id, 78 CAContextID fullscreen_low_power_ca_context_id,
(...skipping 20 matching lines...) Expand all
92 base::scoped_nsobject<CALayerHost> ca_context_layer); 99 base::scoped_nsobject<CALayerHost> ca_context_layer);
93 void DestroyLocalLayer(); 100 void DestroyLocalLayer();
94 void EnsureLocalLayer(); 101 void EnsureLocalLayer();
95 102
96 // The AcceleratedWidgetMacNSView that is using this as its internals. 103 // The AcceleratedWidgetMacNSView that is using this as its internals.
97 AcceleratedWidgetMacNSView* view_; 104 AcceleratedWidgetMacNSView* view_;
98 105
99 // A phony NSView handle used to identify this. 106 // A phony NSView handle used to identify this.
100 gfx::AcceleratedWidget native_widget_; 107 gfx::AcceleratedWidget native_widget_;
101 108
109 // The fullscreen low power coordinator. Weak, reset by
110 // SetFullscreenLowPowerCoordinator when it is destroyed.
111 FullscreenLowPowerCoordinator* fslp_coordinator_ = nullptr;
112
102 // A flipped layer, which acts as the parent of the compositing and software 113 // A flipped layer, which acts as the parent of the compositing and software
103 // layers. This layer is flipped so that the we don't need to recompute the 114 // layers. This layer is flipped so that the we don't need to recompute the
104 // origin for sub-layers when their position changes (this is impossible when 115 // origin for sub-layers when their position changes (this is impossible when
105 // using remote layers, as their size change cannot be synchronized with the 116 // using remote layers, as their size change cannot be synchronized with the
106 // window). This indirection is needed because flipping hosted layers (like 117 // window). This indirection is needed because flipping hosted layers (like
107 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable 118 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable
108 // behavior. 119 // behavior.
109 base::scoped_nsobject<CALayer> flipped_layer_; 120 base::scoped_nsobject<CALayer> flipped_layer_;
110 121
111 // The accelerated CoreAnimation layers hosted by the GPU process. 122 // The accelerated CoreAnimation layers hosted by the GPU process.
(...skipping 19 matching lines...) Expand all
131 CAContextID fullscreen_low_power_ca_context_id, 142 CAContextID fullscreen_low_power_ca_context_id,
132 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, 143 base::ScopedCFTypeRef<IOSurfaceRef> io_surface,
133 const gfx::Size& pixel_size, 144 const gfx::Size& pixel_size,
134 float scale_factor, 145 float scale_factor,
135 base::TimeTicks* vsync_timebase, 146 base::TimeTicks* vsync_timebase,
136 base::TimeDelta* vsync_interval); 147 base::TimeDelta* vsync_interval);
137 148
138 } // namespace ui 149 } // namespace ui
139 150
140 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ 151 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_
OLDNEW
« no previous file with comments | « ui/accelerated_widget_mac/BUILD.gn ('k') | ui/accelerated_widget_mac/accelerated_widget_mac.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698