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/android_image_generator.h"
7 #include "flutter/shell/platform/android/flutter_main.h"
8 #include "flutter/shell/platform/android/platform_view_android.h"
9 #include "flutter/shell/platform/android/vsync_waiter_android.h"
10 
11 // This is called by the VM when the shared library is first loaded.
12 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
13  // Initialize the Java VM.
15 
16  JNIEnv* env = fml::jni::AttachCurrentThread();
17  bool result = false;
18 
19  // Register FlutterMain.
20  result = flutter::FlutterMain::Register(env);
21  FML_CHECK(result);
22 
23  // Register PlatformView
25  FML_CHECK(result);
26 
27  // Register VSyncWaiter.
29  FML_CHECK(result);
30 
31  // Register AndroidImageDecoder.
33  FML_CHECK(result);
34 
35  return JNI_VERSION_1_4;
36 }
GAsyncResult * result
void InitJavaVM(JavaVM *vm)
Definition: jni_util.cc:29
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:34