/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.react;
import static com.facebook.infer.annotation.ThreadConfined.UI;
import static com.facebook.react.bridge.ReactMarkerConstants.ATTACH_MEASURED_ROOT_VIEWS_END;
import static com.facebook.react.bridge.ReactMarkerConstants.ATTACH_MEASURED_ROOT_VIEWS_START;
import static com.facebook.react.bridge.ReactMarkerConstants.BUILD_NATIVE_MODULE_REGISTRY_END;
import static com.facebook.react.bridge.ReactMarkerConstants.BUILD_NATIVE_MODULE_REGISTRY_START;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_CATALYST_INSTANCE_END;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_CATALYST_INSTANCE_START;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_REACT_CONTEXT_START;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_VIEW_MANAGERS_END;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_VIEW_MANAGERS_START;
import static com.facebook.react.bridge.ReactMarkerConstants.PRE_SETUP_REACT_CONTEXT_END;
import static com.facebook.react.bridge.ReactMarkerConstants.PRE_SETUP_REACT_CONTEXT_START;
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_PACKAGES_END;
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_PACKAGES_START;
import static com.facebook.react.bridge.ReactMarkerConstants.REACT_CONTEXT_THREAD_END;
import static com.facebook.react.bridge.ReactMarkerConstants.REACT_CONTEXT_THREAD_START;
import static com.facebook.react.bridge.ReactMarkerConstants.SETUP_REACT_CONTEXT_END;
import static com.facebook.react.bridge.ReactMarkerConstants.SETUP_REACT_CONTEXT_START;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_APPS;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JSC_CALLS;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Process;
import android.util.Log;
import android.view.View;
import com.facebook.common.logging.FLog;
import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.infer.annotation.ThreadSafe;
import com.facebook.react.bridge.CatalystInstance;
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JavaJSExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.bridge.NativeArray;
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
import com.facebook.react.bridge.NativeModuleRegistry;
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
import com.facebook.react.bridge.ProxyJavaScriptExecutor;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler;
import com.facebook.react.devsupport.RedBoxHandler;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.core.ReactChoreographer;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper;
import com.facebook.soloader.SoLoader;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
/**
* This class is managing instances of {@link CatalystInstance}. It exposes a way to configure
* catalyst instance using {@link ReactPackage} and keeps track of the lifecycle of that
* instance. It also sets up connection between the instance and developers support functionality
* of the framework.
*
* An instance of this manager is required to start JS application in {@link ReactRootView} (see
* {@link ReactRootView#startReactApplication} for more info).
*
* The lifecycle of the instance of {@link ReactInstanceManager} should be bound to the
* activity that owns the {@link ReactRootView} that is used to render react application using this
* instance manager (see {@link ReactRootView#startReactApplication}). It's required to pass owning
* activity's lifecycle events to the instance manager (see {@link #onHostPause}, {@link
* #onHostDestroy} and {@link #onHostResume}).
*
* To instantiate an instance of this class use {@link #builder}.
*/
@ThreadSafe
public class ReactInstanceManager {
private static final String TAG = ReactInstanceManager.class.getSimpleName();
/**
* Listener interface for react instance events.
*/
public interface ReactInstanceEventListener {
/**
* Called when the react context is initialized (all modules registered). Always called on the
* UI thread.
*/
void onReactContextInitialized(ReactContext context);
}
private final List<ReactRootView> mAttachedRootViews = Collections.synchronizedList(
new ArrayList<ReactRootView>());
private volatile LifecycleState mLifecycleState;
private @Nullable @ThreadConfined(UI) ReactContextInitParams mPendingReactContextInitParams;
private volatile @Nullable Thread mCreateReactContextThread;
/* accessed from any thread */
private final JavaScriptExecutorFactory mJavaScriptExecutorFactory;
private final @Nullable JSBundleLoader mBundleLoader;
private final @Nullable String mJSMainModulePath; /* path to JS bundle root on packager server */
private final List<ReactPackage> mPackages;
private final List<CatalystInstanceImpl.PendingJSCall> mInitFunctions;
private final DevSupportManager mDevSupportManager;
private final boolean mUseDeveloperSupport;
private final @Nullable NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener;
private final Object mReactContextLock = new Object();
private @Nullable volatile ReactContext mCurrentReactContext;
private final Context mApplicationContext;
private @Nullable @ThreadConfined(UI) DefaultHardwareBackBtnHandler mDefaultBackButtonImpl;
private @Nullable Activity mCurrentActivity;
private final Collection<ReactInstanceEventListener> mReactInstanceEventListeners =
Collections.synchronizedSet(new HashSet<ReactInstanceEventListener>());
// Identifies whether the instance manager is or soon will be initialized (on background thread)
private volatile boolean mHasStartedCreatingInitialContext
没有合适的资源?快使用搜索试试~ 我知道了~
react-native-0.50.3.zip
共2000个文件
java:653个
js:546个
h:386个
需积分: 0 0 下载量 75 浏览量
更新于2024-08-29
收藏 29.92MB ZIP 举报
一个使用 React 构建 app 应用程序的框架
A framework for building native applications using React
收起资源包目录
react-native-0.50.3.zip (2000个子文件)
Yoga.c 160KB
fishhook.c 8KB
YGEnums.c 5KB
YGNodeList.c 2KB
JSCExecutor.cpp 27KB
YGJNI.cpp 27KB
Exceptions.cpp 12KB
Value.cpp 10KB
CatalystInstanceImpl.cpp 10KB
JSCTracing.cpp 10KB
JSCPerfLogging.cpp 9KB
LocalString.cpp 9KB
JSCHelpers.cpp 9KB
jscexecutor.cpp 9KB
fbjni.cpp 8KB
NativeToJsBridge.cpp 8KB
MicroProfiler.cpp 7KB
MethodInvoker.cpp 7KB
JavaModuleWrapper.cpp 6KB
OnLoad.cpp 6KB
jni_helpers.cpp 6KB
CxxNativeModule.cpp 6KB
systemJSCWrapper.cpp 5KB
Environment.cpp 5KB
methodcall.cpp 5KB
ReadableNativeMap.cpp 5KB
ModuleRegistry.cpp 5KB
Instance.cpp 5KB
AndroidJSCFactory.cpp 5KB
ProxyExecutor.cpp 4KB
jsarg_helpers.cpp 4KB
SampleCxxModule.cpp 4KB
JSCPerfStats.cpp 3KB
OnLoad.cpp 3KB
JInspector.cpp 3KB
ReadableNativeArray.cpp 3KB
value.cpp 3KB
lyra.cpp 3KB
glog_init.cpp 3KB
JSIndexedRAMBundle.cpp 3KB
Unicode.cpp 3KB
JniJSModulesUnbundle.cpp 3KB
WritableNativeMap.cpp 3KB
JMessageQueueThread.cpp 3KB
ModuleRegistryBuilder.cpp 3KB
ByteBuffer.cpp 2KB
log.cpp 2KB
MethodCall.cpp 2KB
Countable.cpp 2KB
CpuCapabilities.cpp 2KB
JSCNativeModules.cpp 2KB
WritableNativeArray.cpp 2KB
JSCLegacyTracing.cpp 2KB
JSLoader.cpp 2KB
NativeCommon.cpp 2KB
SamplingProfilerJniMethod.cpp 2KB
CxxModuleWrapper.cpp 2KB
JSCUtils.cpp 1KB
RAMBundleRegistry.cpp 1KB
jsbigstring.cpp 1KB
WeakReference.cpp 1KB
assert.cpp 1KB
JSCMemory.cpp 1KB
RecoverableErrorTest.cpp 1KB
JSCWrapper.cpp 1KB
jsclogging.cpp 1KB
JSLogging.cpp 1008B
NativeArray.cpp 970B
References.cpp 928B
JSBundleType.cpp 858B
ReferenceChecking.cpp 838B
JSPackagerClientResponder.cpp 809B
JSCSamplingProfiler.cpp 780B
JniRAMBundleRegistry.cpp 780B
JSIndexedRAMBundleRegistry.cpp 770B
onload.cpp 751B
Hybrid.cpp 745B
InspectorInterfaces.cpp 730B
JSBigString.cpp 700B
NativeMap.cpp 692B
OnLoad.cpp 603B
Platform.cpp 574B
OnLoad.cpp 362B
PrivateDataBase.cpp 172B
react-native.css 40KB
prism.css 2KB
style.css 1KB
jni.h 51KB
CoreClasses.h 22KB
References.h 20KB
CoreClasses-inl.h 19KB
Meta-inl.h 17KB
References-inl.h 14KB
Yoga.h 13KB
Meta.h 12KB
JavaScriptCore.h 11KB
RCTBridgeModule.h 11KB
RCTShadowView.h 11KB
Hybrid.h 10KB
Value.h 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源推荐
资源预览
资源评论
200 浏览量
2019-10-31 上传
2024-08-30 上传
147 浏览量
137 浏览量
124 浏览量
2024-08-30 上传
163 浏览量
182 浏览量
5星 · 资源好评率100%
128 浏览量
2024-08-30 上传
2019-07-19 上传
2017-08-17 上传
171 浏览量
2019-09-26 上传
173 浏览量
5星 · 资源好评率100%
163 浏览量
2019-09-17 上传
2019-10-10 上传
153 浏览量
2019-09-17 上传
2019-09-17 上传
108 浏览量
109 浏览量
2019-09-17 上传
106 浏览量
资源评论
a3737337
- 粉丝: 0
- 资源: 2869
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 【人员录用】05-用人部门入职通知邮件.docx
- 08-新员工入职流程.xlsx
- 11-新员工入职流程图.xlsx
- 09-新员工入职流程及程序doc.docx
- 17-新员工入职关怀跟踪反馈表.docx
- 20-员工重新入职管理制度.docx
- 01-新员工入职指引管理办法.docx
- 基恩士KV-N60,KV-N14程序 基恩士KV-N60主站,KV-N14从站,松下触摸屏 KV-N11L(RS422A 485通信插件)主从站485串行PLC链路站通信功能 全自动端子焊锡机
- 09-新员工入职引导确认表.doc
- 05-新员工入职引导作业指导书.xls
- 11-新员工入职指引.docx
- 12-新员工入职指南.xlsx
- 13-新员工入职指引流程.xlsx
- 15-新员工入职服务操作细则.xls
- 14-新员工管理流程-各角色职责说明.xls
- 06-新员工入职须知.doc.docx
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功