Flutter Engine
vsync_waiter_android.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 #ifndef SHELL_PLATFORM_ANDROID_VSYNC_WAITER_ANDROID_H_
6 #define SHELL_PLATFORM_ANDROID_VSYNC_WAITER_ANDROID_H_
7 
8 #include <jni.h>
9 
10 #include <memory>
11 
12 #include "flutter/fml/macros.h"
13 #include "flutter/shell/common/vsync_waiter.h"
14 
15 namespace flutter {
16 
17 class VsyncWaiterAndroid final : public VsyncWaiter {
18  public:
19  static bool Register(JNIEnv* env);
20 
22 
23  ~VsyncWaiterAndroid() override;
24 
25  private:
26  // |VsyncWaiter|
27  void AwaitVSync() override;
28 
29  static void OnNativeVsync(JNIEnv* env,
30  jclass jcaller,
31  jlong frameTimeNanos,
32  jlong frameTargetTimeNanos,
33  jlong java_baton);
34 
35  static void ConsumePendingCallback(jlong java_baton,
36  fml::TimePoint frame_start_time,
37  fml::TimePoint frame_target_time);
38 
39  FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterAndroid);
40 };
41 
42 } // namespace flutter
43 
44 #endif // SHELL_PLATFORM_ANDROID_ASYNC_WAITER_ANDROID_H_
VsyncWaiterAndroid(flutter::TaskRunners task_runners)
static bool Register(JNIEnv *env)