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

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

Issue 1273563002: Mac Overlays: Add GPU back-pressure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More sdk differences Created 5 years, 4 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 21 matching lines...) Expand all
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 AcceleratedWidgetGetDisplayID() const = 0;
42 virtual void AcceleratedWidgetSwapCompleted( 43 virtual void AcceleratedWidgetSwapCompleted(
43 const std::vector<ui::LatencyInfo>& latency_info) = 0; 44 const std::vector<ui::LatencyInfo>& latency_info) = 0;
44 virtual void AcceleratedWidgetHitError() = 0; 45 virtual void AcceleratedWidgetHitError() = 0;
45 }; 46 };
46 47
47 #if defined(__OBJC__) 48 #if defined(__OBJC__)
48 49
49 // AcceleratedWidgetMac owns a tree of CALayers. The widget may be passed 50 // 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 51 // to a ui::Compositor, which will cause, through its output surface, calls to
51 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed 52 // GotAcceleratedFrame and GotSoftwareFrame. The CALayers may be installed
52 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper. 53 // in an NSView by setting the AcceleratedWidgetMacNSView for the helper.
53 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac 54 class ACCELERATED_WIDGET_MAC_EXPORT AcceleratedWidgetMac
54 : public IOSurfaceLayerClient { 55 : public IOSurfaceLayerClient {
55 public: 56 public:
56 explicit AcceleratedWidgetMac(bool needs_gl_finish_workaround); 57 explicit AcceleratedWidgetMac(bool needs_gl_finish_workaround);
57 virtual ~AcceleratedWidgetMac(); 58 virtual ~AcceleratedWidgetMac();
58 59
59 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; } 60 gfx::AcceleratedWidget accelerated_widget() { return native_widget_; }
60 61
61 void SetNSView(AcceleratedWidgetMacNSView* view); 62 void SetNSView(AcceleratedWidgetMacNSView* view);
62 void ResetNSView(); 63 void ResetNSView();
63 64
64 // Return true if the last frame swapped has a size in DIP of |dip_size|. 65 // Return true if the last frame swapped has a size in DIP of |dip_size|.
65 bool HasFrameOfSize(const gfx::Size& dip_size) const; 66 bool HasFrameOfSize(const gfx::Size& dip_size) const;
66 67
67 // Return the CGL renderer ID for the surface, if one is available. 68 // Return the CGL renderer ID for the surface, if one is available.
68 int GetRendererID() const; 69 int GetRendererID() const;
69 70
71 // Return the CG display ID for the surface, if known.
72 uint32_t GetDisplayID() const;
73
70 // Return true if the renderer should not be throttled by GPU back-pressure. 74 // Return true if the renderer should not be throttled by GPU back-pressure.
71 bool IsRendererThrottlingDisabled() const; 75 bool IsRendererThrottlingDisabled() const;
72 76
73 // Mark a bracket in which new frames are being pumped in a restricted nested 77 // Mark a bracket in which new frames are being pumped in a restricted nested
74 // run loop. 78 // run loop.
75 void BeginPumpingFrames(); 79 void BeginPumpingFrames();
76 void EndPumpingFrames(); 80 void EndPumpingFrames();
77 81
78 void GotAcceleratedFrame( 82 void GotAcceleratedFrame(
79 uint64 surface_handle, 83 uint64 surface_handle,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 #endif // __OBJC__ 158 #endif // __OBJC__
155 159
156 ACCELERATED_WIDGET_MAC_EXPORT 160 ACCELERATED_WIDGET_MAC_EXPORT
157 void AcceleratedWidgetMacGotAcceleratedFrame( 161 void AcceleratedWidgetMacGotAcceleratedFrame(
158 gfx::AcceleratedWidget widget, uint64 surface_handle, 162 gfx::AcceleratedWidget widget, uint64 surface_handle,
159 const std::vector<ui::LatencyInfo>& latency_info, 163 const std::vector<ui::LatencyInfo>& latency_info,
160 const gfx::Size& pixel_size, 164 const gfx::Size& pixel_size,
161 float scale_factor, 165 float scale_factor,
162 const gfx::Rect& pixel_damage_rect, 166 const gfx::Rect& pixel_damage_rect,
163 const base::Closure& drawn_callback, 167 const base::Closure& drawn_callback,
164 bool* disable_throttling, int* renderer_id); 168 bool* disable_throttling, int* renderer_id, uint32_t* display_id);
165 169
166 ACCELERATED_WIDGET_MAC_EXPORT 170 ACCELERATED_WIDGET_MAC_EXPORT
167 void AcceleratedWidgetMacGotSoftwareFrame( 171 void AcceleratedWidgetMacGotSoftwareFrame(
168 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas); 172 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas);
169 173
170 } // namespace ui 174 } // namespace ui
171 175
172 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ 176 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698