/**
* 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.2.zip
共2000个文件
java:653个
js:546个
h:386个
需积分: 0 0 下载量 100 浏览量
更新于2024-08-29
收藏 29.92MB ZIP 举报
一个使用 React 构建 app 应用程序的框架
A framework for building native applications using React
收起资源包目录
react-native-0.50.2.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
资源推荐
资源预览
资源评论
2019-10-04 上传
2019-10-31 上传
103 浏览量
2021-08-06 上传
2019-07-19 上传
2024-08-30 上传
167 浏览量
146 浏览量
158 浏览量
5星 · 资源好评率100%
181 浏览量
2024-08-30 上传
2019-07-19 上传
116 浏览量
128 浏览量
175 浏览量
141 浏览量
5星 · 资源好评率100%
2019-09-17 上传
189 浏览量
163 浏览量
145 浏览量
161 浏览量
120 浏览量
2019-09-17 上传
2019-09-17 上传
200 浏览量
资源评论
a3737337
- 粉丝: 0
- 资源: 2869
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于web的在线学习管理系统设计与实现
- 基于JavaWeb的汽车租赁平台论文.doc
- 基于javaweb的KTV点歌管理系统论文.doc
- 预警插件-Fine-report11
- 建设项目现场高温人员中暑事故应急预案.docx
- 建设项目工程超高层测量放线控制方案.docx
- 建筑公司建设项目现场雷电事故应急预案.docx
- 建筑公司员工食物中毒事故应急预案.docx
- 建筑公司建设项目现场风灾事故应急预案.docx
- 建筑集团建设项目火险应急预案.docx
- 深圳建设施工项目物体打击事故应急预案.docx
- 深圳建设项目高处坠落事故应急预案.docx
- 深圳建设项目机械伤害事故应急预案.docx
- 深圳建设项目施工现场各类事故应急预案.docx
- 深圳建设项目现场触电应急预案.docx
- 深圳建设项目坍塌事故应急预案.docx
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功