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 UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 6 #define UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
7 | 7 |
8 #include <d3d9.h> | 8 #include <d3d9.h> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // presenter has affinity. | 70 // presenter has affinity. |
71 void DoPresentAndAcknowledge( | 71 void DoPresentAndAcknowledge( |
72 const gfx::Size& size, | 72 const gfx::Size& size, |
73 int64 surface_handle, | 73 int64 surface_handle, |
74 const base::Callback<void(bool)>& completion_task); | 74 const base::Callback<void(bool)>& completion_task); |
75 void DoSuspend(); | 75 void DoSuspend(); |
76 void DoPresent(HDC dc, bool* presented); | 76 void DoPresent(HDC dc, bool* presented); |
77 bool DoRealPresent(HDC dc); | 77 bool DoRealPresent(HDC dc); |
78 void DoReleaseSurface(); | 78 void DoReleaseSurface(); |
79 | 79 |
| 80 // This gets the timestamp and period of the display's last vsync. |
| 81 // The period is represented as a ratio which, when divided, will give you |
| 82 // the interval in seconds. i.e.: |
| 83 // inteval_in_seconds = interval_numerator / interval_denominator; |
| 84 // For example, some machines will return an interval_numerator of 1001 |
| 85 // and an interval_denominator of 60000, resulting in an interval of |
| 86 // 1001/60000 ~= .016683 seconds |
| 87 // Note: This function assumes lock_ is acquired. |
| 88 void GetPresentationStats(base::TimeTicks* timebase, |
| 89 uint32* interval_numerator, |
| 90 uint32* interval_denominator); |
| 91 |
80 // The thread with which this presenter has affinity. | 92 // The thread with which this presenter has affinity. |
81 PresentThread* const present_thread_; | 93 PresentThread* const present_thread_; |
82 | 94 |
83 // The window that is presented to. | 95 // The window that is presented to. |
84 gfx::NativeWindow window_; | 96 gfx::NativeWindow window_; |
85 | 97 |
86 // The lock is taken while any thread is calling the object, except those that | 98 // The lock is taken while any thread is calling the object, except those that |
87 // simply post from the main thread to the present thread via the immutable | 99 // simply post from the main thread to the present thread via the immutable |
88 // present_thread_ member. | 100 // present_thread_ member. |
89 base::Lock lock_; | 101 base::Lock lock_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 149 |
138 // Indicates that the surface has become invisible. | 150 // Indicates that the surface has become invisible. |
139 void WasHidden(); | 151 void WasHidden(); |
140 | 152 |
141 private: | 153 private: |
142 const scoped_refptr<AcceleratedPresenter> presenter_; | 154 const scoped_refptr<AcceleratedPresenter> presenter_; |
143 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); | 155 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |
144 }; | 156 }; |
145 | 157 |
146 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 158 #endif // UI_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
OLD | NEW |