OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class AcceleratedWidgetMac; | 33 class AcceleratedWidgetMac; |
34 | 34 |
35 // A class through which an AcceleratedWidget may be bound to draw the contents | 35 // 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 | 36 // of an NSView. An AcceleratedWidget may be bound to multiple different views |
37 // throughout its lifetime (one at a time, though). | 37 // throughout its lifetime (one at a time, though). |
38 class AcceleratedWidgetMacNSView { | 38 class AcceleratedWidgetMacNSView { |
39 public: | 39 public: |
40 virtual NSView* AcceleratedWidgetGetNSView() const = 0; | 40 virtual NSView* AcceleratedWidgetGetNSView() const = 0; |
41 virtual bool AcceleratedWidgetShouldIgnoreBackpressure() const = 0; | 41 virtual bool AcceleratedWidgetShouldIgnoreBackpressure() const = 0; |
42 virtual uint32_t AcceleratedWidgetGetDisplayIDForVSync() const = 0; | |
43 virtual void AcceleratedWidgetSwapCompleted( | 42 virtual void AcceleratedWidgetSwapCompleted( |
44 const std::vector<ui::LatencyInfo>& latency_info) = 0; | 43 const std::vector<ui::LatencyInfo>& latency_info) = 0; |
45 virtual void AcceleratedWidgetHitError() = 0; | 44 virtual void AcceleratedWidgetHitError() = 0; |
46 }; | 45 }; |
47 | 46 |
48 #if defined(__OBJC__) | 47 #if defined(__OBJC__) |
49 | 48 |
50 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed | 49 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed |
51 // 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 |
52 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed | 51 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed |
53 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper. | 52 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper. |
54 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac | 53 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac |
55 : public IOSurfaceLayerClient { | 54 : public IOSurfaceLayerClient { |
56 public: | 55 public: |
57 explicit AcceleratedWidgetMac(bool needs_gl_finish_workaround); | 56 explicit AcceleratedWidgetMac(bool needs_gl_finish_workaround); |
58 virtual ~AcceleratedWidgetMac(); | 57 virtual ~AcceleratedWidgetMac(); |
59 | 58 |
60 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; } | 59 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; } |
61 | 60 |
62 void SetNSView(AcceleratedWidgetMacNSView* view); | 61 void SetNSView(AcceleratedWidgetMacNSView* view); |
63 void ResetNSView(); | 62 void ResetNSView(); |
64 | 63 |
65 // Return true if the last frame swapped has a size in DIP of |dip_size|. | 64 // Return true if the last frame swapped has a size in DIP of |dip_size|. |
66 bool HasFrameOfSize(const gfx::Size& dip_size) const; | 65 bool HasFrameOfSize(const gfx::Size& dip_size) const; |
67 | 66 |
68 // Return the CGL renderer ID for the surface, if one is available. | 67 // Return the CGL renderer ID for the surface, if one is available. |
69 int GetRendererID() const; | 68 int GetRendererID() const; |
70 | 69 |
71 // Return the CG display ID for the surface, if known. | |
72 uint32_t GetDisplayIDForVSync() const; | |
73 | |
74 // Return true if the renderer should not be throttled by GPU back-pressure. | 70 // Return true if the renderer should not be throttled by GPU back-pressure. |
75 bool IsRendererThrottlingDisabled() const; | 71 bool IsRendererThrottlingDisabled() const; |
76 | 72 |
77 // Mark a bracket in which new frames are being pumped in a restricted nested | 73 // Mark a bracket in which new frames are being pumped in a restricted nested |
78 // run loop. | 74 // run loop. |
79 void BeginPumpingFrames(); | 75 void BeginPumpingFrames(); |
80 void EndPumpingFrames(); | 76 void EndPumpingFrames(); |
81 | 77 |
82 void GotAcceleratedFrame( | 78 void GotAcceleratedFrame( |
83 uint64 surface_handle, | 79 uint64 surface_handle, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 #endif // __OBJC__ | 154 #endif // __OBJC__ |
159 | 155 |
160 ACCELERATED_WIDGET_MAC_EXPORT | 156 ACCELERATED_WIDGET_MAC_EXPORT |
161 void AcceleratedWidgetMacGotAcceleratedFrame( | 157 void AcceleratedWidgetMacGotAcceleratedFrame( |
162 gfx::AcceleratedWidget widget, uint64 surface_handle, | 158 gfx::AcceleratedWidget widget, uint64 surface_handle, |
163 const std::vector<ui::LatencyInfo>& latency_info, | 159 const std::vector<ui::LatencyInfo>& latency_info, |
164 const gfx::Size& pixel_size, | 160 const gfx::Size& pixel_size, |
165 float scale_factor, | 161 float scale_factor, |
166 const gfx::Rect& pixel_damage_rect, | 162 const gfx::Rect& pixel_damage_rect, |
167 const base::Closure& drawn_callback, | 163 const base::Closure& drawn_callback, |
168 bool* disable_throttling, int* renderer_id, uint32_t* display_id); | 164 bool* disable_throttling, int* renderer_id); |
169 | 165 |
170 ACCELERATED_WIDGET_MAC_EXPORT | 166 ACCELERATED_WIDGET_MAC_EXPORT |
171 void AcceleratedWidgetMacGotSoftwareFrame( | 167 void AcceleratedWidgetMacGotSoftwareFrame( |
172 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas); | 168 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas); |
173 | 169 |
174 } // namespace ui | 170 } // namespace ui |
175 | 171 |
176 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ | 172 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ |
OLD | NEW |