/**
* 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_JS_VM_CALLS;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Process;
import android.support.v4.view.ViewCompat;
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.ReactInstanceManagerDevHelper;
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 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 = false;
// Identifies wheth
没有合适的资源?快使用搜索试试~ 我知道了~
react-native-0.54.0-rc.3.zip
共2000个文件
java:713个
js:512个
h:414个
需积分: 0 0 下载量 155 浏览量
2024-08-29
16:00:52
上传
评论
收藏 9.16MB ZIP 举报
温馨提示
一个使用 React 构建 app 应用程序的框架 A framework for building native applications using React
资源推荐
资源详情
资源评论
收起资源包目录
react-native-0.54.0-rc.3.zip (2000个子文件)
fishhook.c 8KB
Yoga.cpp 149KB
JSCExecutor.cpp 28KB
YGJNI.cpp 26KB
YGNode.cpp 20KB
Exceptions.cpp 12KB
Value.cpp 11KB
JSCTracing.cpp 10KB
JSCPerfLogging.cpp 9KB
LocalString.cpp 9KB
CatalystInstanceImpl.cpp 9KB
JSCHelpers.cpp 9KB
jscexecutor.cpp 9KB
fbjni.cpp 8KB
NativeToJsBridge.cpp 8KB
ReadableNativeMap.cpp 8KB
YGNodePrint.cpp 7KB
MethodInvoker.cpp 7KB
MicroProfiler.cpp 7KB
JavaModuleWrapper.cpp 6KB
OnLoad.cpp 6KB
CxxNativeModule.cpp 6KB
Instance.cpp 6KB
jni_helpers.cpp 6KB
systemJSCWrapper.cpp 6KB
Environment.cpp 5KB
methodcall.cpp 5KB
ModuleRegistry.cpp 5KB
YGEnums.cpp 5KB
ReadableNativeArray.cpp 5KB
ProxyExecutor.cpp 4KB
jsarg_helpers.cpp 4KB
SampleCxxModule.cpp 4KB
JSIndexedRAMBundle.cpp 3KB
JSCPerfStats.cpp 3KB
AndroidJSCFactory.cpp 3KB
OnLoad.cpp 3KB
value.cpp 3KB
lyra.cpp 3KB
glog_init.cpp 3KB
JInspector.cpp 3KB
Unicode.cpp 3KB
JniJSModulesUnbundle.cpp 3KB
WritableNativeMap.cpp 3KB
InspectorInterfaces.cpp 3KB
JMessageQueueThread.cpp 3KB
ByteBuffer.cpp 2KB
log.cpp 2KB
MethodCall.cpp 2KB
Countable.cpp 2KB
CpuCapabilities.cpp 2KB
JSCNativeModules.cpp 2KB
WritableNativeArray.cpp 2KB
RAMBundleRegistry.cpp 2KB
ReactMarker.cpp 2KB
ModuleRegistryBuilder.cpp 2KB
JSCLegacyTracing.cpp 2KB
JSLoader.cpp 2KB
NativeCommon.cpp 2KB
SamplingProfilerJniMethod.cpp 2KB
CxxModuleWrapper.cpp 2KB
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 856B
Utils.cpp 848B
ReferenceChecking.cpp 838B
JSPackagerClientResponder.cpp 809B
JSCSamplingProfiler.cpp 780B
onload.cpp 751B
Hybrid.cpp 745B
JSBigString.cpp 700B
NativeMap.cpp 692B
OnLoad.cpp 603B
Platform.cpp 574B
JSCUtils.cpp 387B
OnLoad.cpp 362B
PrivateDataBase.cpp 172B
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 14KB
Meta.h 12KB
Yoga-internal.h 12KB
JavaScriptCore.h 11KB
RCTBridgeModule.h 11KB
Hybrid.h 10KB
Value.h 10KB
RCTImageLoader.h 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
a3737337
- 粉丝: 0
- 资源: 2869
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功