Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create JRuntimeExecutor #28779

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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.bridge;

import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;

/** A Java holder for a C++ RuntimeExecutor. */
public class RuntimeExecutor {

@DoNotStrip private HybridData mHybridData;

public RuntimeExecutor(HybridData hybridData) {
mHybridData = hybridData;
}
}
3 changes: 2 additions & 1 deletion ReactAndroid/src/main/jni/react/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga

# The static libraries (.a files) that this module depends on.
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder libruntimeexecutor

# Name of this module.
#
Expand Down Expand Up @@ -70,6 +70,7 @@ $(call import-module,jsi)
$(call import-module,jsiexecutor)
$(call import-module,callinvoker)
$(call import-module,hermes)
$(call import-module,runtimeexecutor)

include $(REACT_SRC_DIR)/turbomodule/core/jni/Android.mk

Expand Down
2 changes: 2 additions & 0 deletions ReactAndroid/src/main/jni/react/jni/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ EXPORTED_HEADERS = [
"NativeMap.h",
"ReadableNativeArray.h",
"ReadableNativeMap.h",
"JRuntimeExecutor.h",
"WritableNativeArray.h",
"WritableNativeMap.h",
]
Expand Down Expand Up @@ -64,6 +65,7 @@ rn_xplat_cxx_library(
react_native_xplat_target("cxxreact:jsbigstring"),
react_native_xplat_target("cxxreact:module"),
react_native_xplat_target("jsinspector:jsinspector"),
react_native_xplat_target("runtimeexecutor:runtimeexecutor"),
react_native_xplat_dep("jsi:jsi"),
FBJNI_TARGET,
]) if not IS_OSS_BUILD else [],
Expand Down
21 changes: 21 additions & 0 deletions ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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 "JRuntimeExecutor.h"

namespace facebook {
namespace react {

JRuntimeExecutor::JRuntimeExecutor(RuntimeExecutor runtimeExecutor)
: runtimeExecutor_(runtimeExecutor) {}

RuntimeExecutor JRuntimeExecutor::get() {
return runtimeExecutor_;
}

} // namespace react
} // namespace facebook
30 changes: 30 additions & 0 deletions ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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/RuntimeExecutor.h>
#include <fbjni/fbjni.h>

namespace facebook {
namespace react {

class JRuntimeExecutor : public jni::HybridClass<JRuntimeExecutor> {
public:
static auto constexpr kJavaDescriptor =
"Lcom/facebook/react/bridge/RuntimeExecutor;";

RuntimeExecutor get();

private:
friend HybridBase;
JRuntimeExecutor(RuntimeExecutor runtimeExecutor);
RuntimeExecutor runtimeExecutor_;
};

} // namespace react
} // namespace facebook
19 changes: 19 additions & 0 deletions ReactCommon/runtimeexecutor/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 := runtimeexecutor

LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/ReactCommon/*.cpp)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/ReactCommon
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)

LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall

include $(BUILD_STATIC_LIBRARY)