mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove RuntimeSchedulerManager
Summary: Changelog: [internal] Remove RuntimeSchedulerManager on Android in favor of different way to initialise RuntimeScheduler. Reviewed By: ShikaSD Differential Revision: D30486975 fbshipit-source-id: 9fe38de12be452bd9d2c92bb54cf5933ce7555b5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dbda1917cc
commit
e2e39808d3
@@ -49,7 +49,6 @@ rn_android_library(
|
||||
react_native_target("java/com/facebook/react/config:config"),
|
||||
react_native_target("java/com/facebook/react/turbomodule/core:core"),
|
||||
react_native_target("java/com/facebook/react/turbomodule/core/interfaces:interfaces"),
|
||||
react_native_target("java/com/facebook/react/runtimescheduler:runtimescheduler"),
|
||||
],
|
||||
exported_deps = [
|
||||
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||
|
||||
@@ -92,7 +92,6 @@ import com.facebook.react.modules.core.ReactChoreographer;
|
||||
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
|
||||
import com.facebook.react.modules.fabric.ReactFabric;
|
||||
import com.facebook.react.packagerconnection.RequestHandler;
|
||||
import com.facebook.react.runtimescheduler.RuntimeSchedulerManager;
|
||||
import com.facebook.react.surface.ReactStage;
|
||||
import com.facebook.react.turbomodule.core.TurboModuleManager;
|
||||
import com.facebook.react.turbomodule.core.TurboModuleManagerDelegate;
|
||||
@@ -167,7 +166,6 @@ public class ReactInstanceManager {
|
||||
private final boolean mUseDeveloperSupport;
|
||||
private final boolean mRequireActivity;
|
||||
private @Nullable ComponentNameResolverManager mComponentNameResolverManager;
|
||||
private @Nullable RuntimeSchedulerManager mRuntimeSchedulerManager;
|
||||
private final @Nullable NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener;
|
||||
private final Object mReactContextLock = new Object();
|
||||
private @Nullable volatile ReactContext mCurrentReactContext;
|
||||
@@ -759,7 +757,6 @@ public class ReactInstanceManager {
|
||||
mViewManagerNames = null;
|
||||
}
|
||||
mComponentNameResolverManager = null;
|
||||
mRuntimeSchedulerManager = null;
|
||||
FLog.d(ReactConstants.TAG, "ReactInstanceManager has been destroyed");
|
||||
}
|
||||
|
||||
@@ -1394,9 +1391,6 @@ public class ReactInstanceManager {
|
||||
});
|
||||
catalystInstance.setGlobalVariable("__fbStaticViewConfig", "true");
|
||||
}
|
||||
if (ReactFeatureFlags.enableRuntimeScheduler) {
|
||||
mRuntimeSchedulerManager = new RuntimeSchedulerManager(catalystInstance.getRuntimeExecutor());
|
||||
}
|
||||
|
||||
ReactMarker.logMarker(ReactMarkerConstants.PRE_RUN_JS_BUNDLE_START);
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "runJSBundle");
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_android_library")
|
||||
|
||||
rn_android_library(
|
||||
name = "runtimescheduler",
|
||||
srcs = glob(["**/*.java"]),
|
||||
autoglob = False,
|
||||
is_androidx = True,
|
||||
labels = ["supermodule:xplat/default/public.react_native.infra"],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_target("java/com/facebook/react/runtimescheduler/jni:jni"),
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("libraries/fbjni:java"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
|
||||
],
|
||||
)
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.runtimescheduler;
|
||||
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.proguard.annotations.DoNotStripAny;
|
||||
import com.facebook.react.bridge.RuntimeExecutor;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@DoNotStripAny
|
||||
public class RuntimeSchedulerManager {
|
||||
|
||||
static {
|
||||
staticInit();
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@SuppressWarnings("unused")
|
||||
private final HybridData mHybridData;
|
||||
|
||||
public RuntimeSchedulerManager(RuntimeExecutor runtimeExecutor) {
|
||||
mHybridData = initHybrid(runtimeExecutor);
|
||||
installJSIBindings();
|
||||
}
|
||||
|
||||
private native HybridData initHybrid(RuntimeExecutor runtimeExecutor);
|
||||
|
||||
private native void installJSIBindings();
|
||||
|
||||
private static void staticInit() {
|
||||
SoLoader.loadLibrary("runtimeschedulerjni");
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := runtimeschedulerjni
|
||||
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libglog libfb libfbjni libglog_init libreact_render_runtimescheduler librrc_native
|
||||
|
||||
LOCAL_STATIC_LIBRARIES :=
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-DLOG_TAG=\"ReacTNative\"
|
||||
|
||||
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,fbgloginit)
|
||||
$(call import-module,fb)
|
||||
$(call import-module,fbjni)
|
||||
$(call import-module,glog)
|
||||
|
||||
$(call import-module,react/renderer/runtimescheduler)
|
||||
@@ -1,35 +0,0 @@
|
||||
load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "react_native_target", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob")
|
||||
|
||||
rn_xplat_cxx_library(
|
||||
name = "jni",
|
||||
srcs = glob(["*.cpp"]),
|
||||
headers = glob(["*.h"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[
|
||||
("", "**/*.h"),
|
||||
],
|
||||
prefix = "react/runtimescheduler",
|
||||
),
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-std=c++17",
|
||||
"-Wall",
|
||||
],
|
||||
fbandroid_allow_jni_merging = True,
|
||||
labels = ["supermodule:xplat/default/public.react_native.infra"],
|
||||
platforms = ANDROID,
|
||||
preprocessor_flags = [
|
||||
"-DLOG_TAG=\"ReactNative\"",
|
||||
"-DWITH_FBSYSTRACE=1",
|
||||
],
|
||||
soname = "libruntimeschedulerjni.$(ext)",
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
react_native_xplat_target("react/renderer/runtimescheduler:runtimescheduler"),
|
||||
react_native_xplat_target("runtimeexecutor:runtimeexecutor"),
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
FBJNI_TARGET,
|
||||
],
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
|
||||
#include "RuntimeSchedulerManager.h"
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
||||
return facebook::jni::initialize(
|
||||
vm, [] { facebook::react::RuntimeSchedulerManager::registerNatives(); });
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
||||
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
|
||||
|
||||
#include "RuntimeSchedulerManager.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
RuntimeSchedulerManager::RuntimeSchedulerManager(
|
||||
RuntimeExecutor runtimeExecutor)
|
||||
: runtimeExecutor_(runtimeExecutor) {}
|
||||
|
||||
jni::local_ref<RuntimeSchedulerManager::jhybriddata>
|
||||
RuntimeSchedulerManager::initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutor) {
|
||||
return makeCxxInstance(runtimeExecutor->cthis()->get());
|
||||
}
|
||||
|
||||
void RuntimeSchedulerManager::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod("initHybrid", RuntimeSchedulerManager::initHybrid),
|
||||
makeNativeMethod(
|
||||
"installJSIBindings", RuntimeSchedulerManager::installJSIBindings),
|
||||
});
|
||||
}
|
||||
|
||||
void RuntimeSchedulerManager::installJSIBindings() {
|
||||
runtimeExecutor_([runtimeExecutor = runtimeExecutor_](jsi::Runtime &runtime) {
|
||||
auto runtimeScheduler = std::make_shared<RuntimeScheduler>(runtimeExecutor);
|
||||
RuntimeSchedulerBinding::createAndInstallIfNeeded(
|
||||
runtime, runtimeScheduler);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/CallInvokerHolder.h>
|
||||
#include <ReactCommon/RuntimeExecutor.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/jni/JRuntimeExecutor.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class RuntimeSchedulerManager
|
||||
: public facebook::jni::HybridClass<RuntimeSchedulerManager> {
|
||||
public:
|
||||
static auto constexpr kJavaDescriptor =
|
||||
"Lcom/facebook/react/runtimescheduler/RuntimeSchedulerManager;";
|
||||
|
||||
static facebook::jni::local_ref<jhybriddata> initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
facebook::jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutor);
|
||||
|
||||
static void registerNatives();
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
RuntimeExecutor runtimeExecutor_;
|
||||
|
||||
void installJSIBindings();
|
||||
|
||||
explicit RuntimeSchedulerManager(RuntimeExecutor runtimeExecutor);
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
Reference in New Issue
Block a user