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. |
77 void GetVSyncParameters(base::TimeTicks* timebase, | 79 void GetVSyncParameters(base::TimeTicks* timebase, |
78 uint32* interval_numerator, | 80 uint32* interval_numerator, |
79 uint32* interval_denominator); | 81 uint32* interval_denominator); |
80 | 82 |
81 private: | 83 private: |
82 friend CVReturn DisplayLinkCallback(CVDisplayLinkRef, | 84 friend CVReturn DisplayLinkCallback(CVDisplayLinkRef, |
83 const CVTimeStamp*, | 85 const CVTimeStamp*, |
84 const CVTimeStamp*, | 86 const CVTimeStamp*, |
85 CVOptionFlags, | 87 CVOptionFlags, |
86 CVOptionFlags*, | 88 CVOptionFlags*, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 153 |
152 // Returns true if IOSurface is ready to render. False otherwise. | 154 // Returns true if IOSurface is ready to render. False otherwise. |
153 bool MapIOSurfaceToTexture(uint64 io_surface_handle); | 155 bool MapIOSurfaceToTexture(uint64 io_surface_handle); |
154 | 156 |
155 void UnrefIOSurfaceWithContextCurrent(); | 157 void UnrefIOSurfaceWithContextCurrent(); |
156 | 158 |
157 void DrawQuad(const SurfaceQuad& quad); | 159 void DrawQuad(const SurfaceQuad& quad); |
158 | 160 |
159 // Called on display-link thread. | 161 // Called on display-link thread. |
160 void DisplayLinkTick(CVDisplayLinkRef display_link, | 162 void DisplayLinkTick(CVDisplayLinkRef display_link, |
161 const CVTimeStamp* output_time); | 163 const CVTimeStamp* time); |
162 | 164 |
163 void CalculateVsyncParametersLockHeld(const CVTimeStamp* time); | 165 void CalculateVsyncParametersLockHeld(const CVTimeStamp* time); |
164 | 166 |
165 // Prevent from spinning on CGLFlushDrawable when it fails to throttle to | 167 // Prevent from spinning on CGLFlushDrawable when it fails to throttle to |
166 // VSync frequency. | 168 // VSync frequency. |
167 void RateLimitDraws(); | 169 void RateLimitDraws(); |
168 | 170 |
169 void StartOrContinueDisplayLink(); | 171 void StartOrContinueDisplayLink(); |
170 void StopDisplayLink(); | 172 void StopDisplayLink(); |
171 | 173 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 217 |
216 // Vsync timing data. | 218 // Vsync timing data. |
217 base::TimeTicks vsync_timebase_; | 219 base::TimeTicks vsync_timebase_; |
218 uint32 vsync_interval_numerator_; | 220 uint32 vsync_interval_numerator_; |
219 uint32 vsync_interval_denominator_; | 221 uint32 vsync_interval_denominator_; |
220 }; | 222 }; |
221 | 223 |
222 } // namespace content | 224 } // namespace content |
223 | 225 |
224 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 226 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
OLD | NEW |