Flutter Engine
The 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 FLUTTER_SHELL_PLATFORM_ANDROID_VSYNC_WAITER_ANDROID_H_
6#define FLUTTER_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
15namespace flutter {
16
17class AndroidChoreographer;
18
19class VsyncWaiterAndroid final : public VsyncWaiter {
20 public:
21 static bool Register(JNIEnv* env);
22
23 explicit VsyncWaiterAndroid(const flutter::TaskRunners& task_runners);
24
26
27 private:
28 // |VsyncWaiter|
29 void AwaitVSync() override;
30
31 static void OnVsyncFromNDK(int64_t frame_nanos, void* data);
32
33 static void OnVsyncFromJava(JNIEnv* env,
34 jclass jcaller,
35 jlong frameDelayNanos,
36 jlong refreshPeriodNanos,
37 jlong java_baton);
38
39 static void ConsumePendingCallback(std::weak_ptr<VsyncWaiter>* weak_this,
40 fml::TimePoint frame_start_time,
41 fml::TimePoint frame_target_time);
42
43 static void OnUpdateRefreshRate(JNIEnv* env,
44 jclass jcaller,
45 jfloat refresh_rate);
46
47 FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterAndroid);
48};
49
50} // namespace flutter
51
52#endif // FLUTTER_SHELL_PLATFORM_ANDROID_VSYNC_WAITER_ANDROID_H_
static bool Register(JNIEnv *env)
friend class VsyncWaiterAndroid
Definition: vsync_waiter.h:41
Definition: __init__.py:1
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition: switches.h:41