mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Corects a bnuch of typeos throughout teh engien codebsae. Also makes a couple minor Commonwealth -> US spelling adjustments for consistency with the rest of Flutter's codebase. Made use of `misspell` tool: https://github.com/client9/misspell
28 lines
1.0 KiB
Java
28 lines
1.0 KiB
Java
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
package io.flutter.view;
|
|
|
|
import android.view.Choreographer;
|
|
|
|
public class VsyncWaiter {
|
|
// This estimate will be updated by FlutterView when it is attached to a Display.
|
|
public static long refreshPeriodNanos = 1000000000 / 60;
|
|
|
|
// This should also be updated by FlutterView when it is attached to a Display.
|
|
// The initial value of 0.0 indicates unknown refresh rate.
|
|
public static float refreshRateFPS = 0.0f;
|
|
|
|
public static void asyncWaitForVsync(final long cookie) {
|
|
Choreographer.getInstance().postFrameCallback(new Choreographer.FrameCallback() {
|
|
@Override
|
|
public void doFrame(long frameTimeNanos) {
|
|
nativeOnVsync(frameTimeNanos, frameTimeNanos + refreshPeriodNanos, cookie);
|
|
}
|
|
});
|
|
}
|
|
|
|
private static native void nativeOnVsync(long frameTimeNanos, long frameTargetTimeNanos, long cookie);
|
|
}
|