mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The engine was using a global to store a timestamp representing the launch of the engine. This timestamp is initialized with a JNI call on Android and during shell setup on other platforms. Later the timestamp is added to a FlutterEngineMainEnter timeline event used to measure engine startup time in benchmarks. This PR removes the global and the JNI call and moves the timestamp into the settings object.
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// 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.
|
|
|
|
#ifndef SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
|
|
#define SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
|
|
|
|
#include <jni.h>
|
|
|
|
#include "flutter/common/settings.h"
|
|
#include "flutter/fml/macros.h"
|
|
#include "flutter/runtime/dart_service_isolate.h"
|
|
|
|
namespace flutter {
|
|
|
|
class FlutterMain {
|
|
public:
|
|
~FlutterMain();
|
|
|
|
static bool Register(JNIEnv* env);
|
|
|
|
static FlutterMain& Get();
|
|
|
|
const flutter::Settings& GetSettings() const;
|
|
|
|
private:
|
|
const flutter::Settings settings_;
|
|
DartServiceIsolate::CallbackHandle observatory_uri_callback_;
|
|
|
|
FlutterMain(flutter::Settings settings);
|
|
|
|
static void Init(JNIEnv* env,
|
|
jclass clazz,
|
|
jobject context,
|
|
jobjectArray jargs,
|
|
jstring kernelPath,
|
|
jstring appStoragePath,
|
|
jstring engineCachesPath,
|
|
jlong initTimeMillis);
|
|
|
|
void SetupObservatoryUriCallback(JNIEnv* env);
|
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(FlutterMain);
|
|
};
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_
|