OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #import <QuartzCore/CVDisplayLink.h> | 9 #import <QuartzCore/CVDisplayLink.h> |
10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 const gfx::Size& pixel_io_surface_size() const { | 68 const gfx::Size& pixel_io_surface_size() const { |
69 return pixel_io_surface_size_; | 69 return pixel_io_surface_size_; |
70 } | 70 } |
71 // In cocoa view units / DIPs. | 71 // In cocoa view units / DIPs. |
72 const gfx::Size& io_surface_size() const { return io_surface_size_; } | 72 const gfx::Size& io_surface_size() const { return io_surface_size_; } |
73 | 73 |
74 bool is_vsync_disabled() const { return is_vsync_disabled_; } | 74 bool is_vsync_disabled() const { return is_vsync_disabled_; } |
75 | 75 |
76 // Get vsync scheduling parameters. | 76 // Get vsync scheduling parameters. |
77 // |interval_numerator/interval_denominator| equates to fractional number of | |
78 // seconds between vsyncs. | |
79 void GetVSyncParameters(base::TimeTicks* timebase, | 77 void GetVSyncParameters(base::TimeTicks* timebase, |
80 uint32* interval_numerator, | 78 uint32* interval_numerator, |
81 uint32* interval_denominator); | 79 uint32* interval_denominator); |
82 | 80 |
83 private: | 81 private: |
84 friend CVReturn DisplayLinkCallback(CVDisplayLinkRef, | 82 friend CVReturn DisplayLinkCallback(CVDisplayLinkRef, |
85 const CVTimeStamp*, | 83 const CVTimeStamp*, |
86 const CVTimeStamp*, | 84 const CVTimeStamp*, |
87 CVOptionFlags, | 85 CVOptionFlags, |
88 CVOptionFlags*, | 86 CVOptionFlags*, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 151 |
154 // Returns true if IOSurface is ready to render. False otherwise. | 152 // Returns true if IOSurface is ready to render. False otherwise. |
155 bool MapIOSurfaceToTexture(uint64 io_surface_handle); | 153 bool MapIOSurfaceToTexture(uint64 io_surface_handle); |
156 | 154 |
157 void UnrefIOSurfaceWithContextCurrent(); | 155 void UnrefIOSurfaceWithContextCurrent(); |
158 | 156 |
159 void DrawQuad(const SurfaceQuad& quad); | 157 void DrawQuad(const SurfaceQuad& quad); |
160 | 158 |
161 // Called on display-link thread. | 159 // Called on display-link thread. |
162 void DisplayLinkTick(CVDisplayLinkRef display_link, | 160 void DisplayLinkTick(CVDisplayLinkRef display_link, |
163 const CVTimeStamp* time); | 161 const CVTimeStamp* output_time); |
164 | 162 |
165 void CalculateVsyncParametersLockHeld(const CVTimeStamp* time); | 163 void CalculateVsyncParametersLockHeld(const CVTimeStamp* time); |
166 | 164 |
167 // Prevent from spinning on CGLFlushDrawable when it fails to throttle to | 165 // Prevent from spinning on CGLFlushDrawable when it fails to throttle to |
168 // VSync frequency. | 166 // VSync frequency. |
169 void RateLimitDraws(); | 167 void RateLimitDraws(); |
170 | 168 |
171 void StartOrContinueDisplayLink(); | 169 void StartOrContinueDisplayLink(); |
172 void StopDisplayLink(); | 170 void StopDisplayLink(); |
173 | 171 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 215 |
218 // Vsync timing data. | 216 // Vsync timing data. |
219 base::TimeTicks vsync_timebase_; | 217 base::TimeTicks vsync_timebase_; |
220 uint32 vsync_interval_numerator_; | 218 uint32 vsync_interval_numerator_; |
221 uint32 vsync_interval_denominator_; | 219 uint32 vsync_interval_denominator_; |
222 }; | 220 }; |
223 | 221 |
224 } // namespace content | 222 } // namespace content |
225 | 223 |
226 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 224 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
OLD | NEW |