Flutter Engine
library_loader.cc
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 #include "flutter/fml/platform/android/jni_util.h"
6 #include "flutter/shell/platform/android/flutter_main.h"
7 #include "flutter/shell/platform/android/platform_view_android.h"
8 #include "flutter/shell/platform/android/vsync_waiter_android.h"
9 
10 // This is called by the VM when the shared library is first loaded.
11 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
12  // Initialize the Java VM.
14 
15  JNIEnv* env = fml::jni::AttachCurrentThread();
16  bool result = false;
17 
18  // Register FlutterMain.
19  result = flutter::FlutterMain::Register(env);
20  FML_CHECK(result);
21 
22  // Register PlatformView
24  FML_CHECK(result);
25 
26  // Register VSyncWaiter.
28  FML_CHECK(result);
29 
30  return JNI_VERSION_1_4;
31 }
void InitJavaVM(JavaVM *vm)
Definition: jni_util.cc:21
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved)
static bool Register(JNIEnv *env)
static bool Register(JNIEnv *env)
#define FML_CHECK(condition)
Definition: logging.h:68
JNIEnv * AttachCurrentThread()
Definition: jni_util.cc:26