1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | package org.chromium.content.browser; |
6 | |
7 | public abstract class VSyncManager { |
8 | /** |
9 | * Interface for requesting notification of the display vsync signal. The provider will call |
10 | * Listener.onVSync() to notify about vsync. The number of registrations and unregistrations of |
11 | * a given listener must be balanced. |
12 | */ |
13 | public static interface Provider { |
14 | void registerVSyncListener(Listener listener); |
15 | void unregisterVSyncListener(Listener listener); |
16 | } |
17 | |
18 | /** |
19 | * Interface for receiving vsync notifications and information about the display refresh |
20 | * interval. |
21 | */ |
22 | public static interface Listener { |
23 | /** |
24 | * Notification of a vsync event. |
25 | * @param frameTimeMicros The latest vsync frame time in microseconds. |
26 | */ |
27 | void onVSync(long frameTimeMicros); |
28 | |
29 | /** |
30 | * Update with the latest vsync parameters. |
31 | * @param tickTimeMicros The latest vsync tick time in microseconds. |
32 | * @param intervalMicros The vsync interval in microseconds. |
33 | */ |
34 | void updateVSync(long tickTimeMicros, long intervalMicros); |
35 | } |
36 | } |