本文整理汇总了Java中com.facebook.systrace.SystraceMessage类的典型用法代码示例。如果您正苦于以下问题:Java SystraceMessage类的具体用法?Java SystraceMessage怎么用?Java SystraceMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SystraceMessage类属于com.facebook.systrace包,在下文中一共展示了SystraceMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNativeModules
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
for (ModuleSpec holder : getNativeModules(reactContext)) {
NativeModule nativeModule;
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createNativeModule")
.arg("module", holder.getType())
.flush();
try {
ReactMarker.logMarker(
ReactMarkerConstants.CREATE_MODULE_START,
holder.getType().getSimpleName());
nativeModule = holder.getProvider().get();
ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
modules.add(nativeModule);
}
return modules;
}
示例2: processPackage
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
private void processPackage(
ReactPackage reactPackage,
NativeModuleRegistryBuilder nativeModuleRegistryBuilder,
JavaScriptModuleRegistry.Builder jsModulesBuilder) {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processPackage")
.arg("className", reactPackage.getClass().getSimpleName())
.flush();
if (reactPackage instanceof ReactPackageLogger) {
((ReactPackageLogger) reactPackage).startProcessPackage();
}
nativeModuleRegistryBuilder.processPackage(reactPackage);
for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
jsModulesBuilder.add(jsModuleClass);
}
if (reactPackage instanceof ReactPackageLogger) {
((ReactPackageLogger) reactPackage).endProcessPackage();
}
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
示例3: create
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
private NativeModule create() {
SoftAssertions.assertCondition(mModule == null, "Creating an already created module.");
ReactMarker.logMarker(CREATE_MODULE_START, mName);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createModule")
.arg("name", mName)
.flush();
NativeModule module = assertNotNull(mProvider).get();
mProvider = null;
if (mInitializeNeeded) {
doInitialize(module);
mInitializeNeeded = false;
}
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker(CREATE_MODULE_END);
return module;
}
示例4: processArguments
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
private void processArguments() {
if (mArgumentsProcessed) {
return;
}
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processArguments")
.arg("method", mModuleWrapper.getName() + "." + mMethod.getName())
.flush();
mArgumentsProcessed = true;
mArgumentExtractors = buildArgumentExtractors(mParameterTypes);
mSignature = buildSignature(mMethod, mParameterTypes, (mType.equals(BaseJavaModule.METHOD_TYPE_SYNC)));
// Since native methods are invoked from a message queue executed on a single thread, it is
// safe to allocate only one arguments object per method that can be reused across calls
mArguments = new Object[mParameterTypes.length];
mJSArgumentsNeeded = calculateJSArgumentsNeeded();
com.facebook.systrace.Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
示例5: getConstants
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
@DoNotStrip
public NativeArray getConstants() {
BaseJavaModule baseJavaModule = getModule();
ReactMarker.logMarker(GET_CONSTANTS_START, getName());
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants")
.arg("moduleName", getName())
.flush();
Map<String, Object> map = baseJavaModule.getConstants();
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "WritableNativeMap constants")
.arg("moduleName", getName())
.flush();
ReactMarker.logMarker(CONVERT_CONSTANTS_START, getName());
WritableNativeMap writableNativeMap;
try {
writableNativeMap = Arguments.makeNativeMap(map);
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
WritableNativeArray array = new WritableNativeArray();
array.pushMap(writableNativeMap);
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
ReactMarker.logMarker(GET_CONSTANTS_END);
return array;
}
示例6: create
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
private NativeModule create() {
boolean isEagerModule = mInfo instanceof LegacyModuleInfo;
String name = isEagerModule ? ((LegacyModuleInfo) mInfo).mType.getSimpleName() : mInfo.name();
if (!isEagerModule) {
ReactMarker.logMarker(CREATE_MODULE_START);
}
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createModule")
.arg("name", name)
.flush();
NativeModule module = assertNotNull(mProvider).get();
if (mInitializeNeeded) {
doInitialize(module);
mInitializeNeeded = false;
}
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
if (!isEagerModule) {
ReactMarker.logMarker(CREATE_MODULE_END);
}
return module;
}
示例7: getConstants
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
@DoNotStrip
public NativeArray getConstants() {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants")
.arg("moduleName", getName())
.flush();
Map<String, Object> map = getModule().getConstants();
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "WritableNativeMap constants")
.arg("moduleName", getName())
.flush();
WritableNativeMap writableNativeMap;
try {
writableNativeMap = Arguments.makeNativeMap(map);
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
WritableNativeArray array = new WritableNativeArray();
array.pushMap(writableNativeMap);
return array;
}
示例8: createView
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
public void createView(
ThemedReactContext themedContext,
int tag,
String className,
@Nullable ReactStylesDiffMap initialProps) {
UiThreadUtil.assertOnUiThread();
SystraceMessage.beginSection(
Systrace.TRACE_TAG_REACT_VIEW,
"NativeViewHierarchyManager_createView")
.arg("tag", tag)
.arg("className", className)
.flush();
try {
ViewManager viewManager = mViewManagers.get(className);
View view = viewManager.createView(themedContext, mJSResponderHandler);
mTagsToViews.put(tag, view);
mTagsToViewManagers.put(tag, viewManager);
// Use android View id field to store React tag. This is possible since we don't inflate
// React views from layout xmls. Thus it is easier to just reuse that field instead of
// creating another (potentially much more expensive) mapping from view to React tag
view.setId(tag);
if (initialProps != null) {
viewManager.updateProperties(view, initialProps);
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_VIEW);
}
}
示例9: calculateRootLayout
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
protected void calculateRootLayout(ReactShadowNode cssRoot) {
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "cssRoot.calculateLayout")
.arg("rootTag", cssRoot.getReactTag())
.flush();
double startTime = (double) System.nanoTime();
try {
cssRoot.calculateLayout();
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
mLayoutTimer = mLayoutTimer + ((double)System.nanoTime() - startTime) / 1000000.0;
mLayoutCount = mLayoutCount + 1;
}
}
示例10: onBatchComplete
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
/**
* To implement the transactional requirement mentioned in the class javadoc, we only commit
* UI changes to the actual view hierarchy once a batch of JS->Java calls have been completed.
* We know this is safe because all JS->Java calls that are triggered by a Java->JS call (e.g.
* the delivery of a touch event or execution of 'renderApplication') end up in a single
* JS->Java transaction.
*
* A better way to do this would be to have JS explicitly signal to this module when a UI
* transaction is done. Right now, though, this is how iOS does it, and we should probably
* update the JS and native code and make this change at the same time.
*
* TODO(5279396): Make JS UI library explicitly notify the native UI module of the end of a UI
* transaction using a standard native call
*/
@Override
public void onBatchComplete() {
int batchId = mBatchId;
mBatchId++;
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "onBatchCompleteUI")
.arg("BatchId", batchId)
.flush();
try {
mUIImplementation.dispatchViewUpdates(batchId);
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
}
示例11: doInitialize
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
private void doInitialize(NativeModule module) {
SystraceMessage.Builder section =
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initialize");
if (module instanceof CxxModuleWrapper) {
section.arg("className", module.getClass().getSimpleName());
} else {
section.arg("name", mName);
}
section.flush();
ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName);
module.initialize();
ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END);
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
示例12: getConstants
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
@DoNotStrip
public @Nullable NativeArray getConstants() {
if (!mModuleHolder.getHasConstants()) {
return null;
}
BaseJavaModule baseJavaModule = getModule();
ReactMarker.logMarker(GET_CONSTANTS_START, getName());
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "Map constants")
.arg("moduleName", getName())
.flush();
Map<String, Object> map = baseJavaModule.getConstants();
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "WritableNativeMap constants")
.arg("moduleName", getName())
.flush();
ReactMarker.logMarker(CONVERT_CONSTANTS_START, getName());
WritableNativeMap writableNativeMap;
try {
writableNativeMap = Arguments.makeNativeMap(map);
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
WritableNativeArray array = new WritableNativeArray();
array.pushMap(writableNativeMap);
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
ReactMarker.logMarker(GET_CONSTANTS_END);
return array;
}
示例13: dispatchViewUpdates
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
void dispatchViewUpdates(final int batchId) {
// Store the current operation queues to dispatch and create new empty ones to continue
// receiving new operations
final ArrayList<UIOperation> operations = mOperations.isEmpty() ? null : mOperations;
if (operations != null) {
mOperations = new ArrayList<>();
}
if (mViewHierarchyUpdateDebugListener != null) {
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateEnqueued();
}
synchronized (mDispatchRunnablesLock) {
mDispatchUIRunnables.add(
new Runnable() {
@Override
public void run() {
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "DispatchUI")
.arg("BatchId", batchId)
.flush();
try {
if (operations != null) {
for (int i = 0; i < operations.size(); i++) {
operations.get(i).execute();
}
}
// Clear layout animation, as animation only apply to current UI operations batch.
mNativeViewHierarchyManager.clearLayoutAnimation();
if (mViewHierarchyUpdateDebugListener != null) {
mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateFinished();
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
}
});
}
}
示例14: calculateRootLayout
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
protected void calculateRootLayout(ReactShadowNode cssRoot) {
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "cssRoot.calculateLayout")
.arg("rootTag", cssRoot.getReactTag())
.flush();
try {
cssRoot.calculateLayout(mLayoutContext);
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
}
示例15: onBatchComplete
import com.facebook.systrace.SystraceMessage; //导入依赖的package包/类
/**
* To implement the transactional requirement mentioned in the class javadoc, we only commit
* UI changes to the actual view hierarchy once a batch of JS->Java calls have been completed.
* We know this is safe because all JS->Java calls that are triggered by a Java->JS call (e.g.
* the delivery of a touch event or execution of 'renderApplication') end up in a single
* JS->Java transaction.
*
* A better way to do this would be to have JS explicitly signal to this module when a UI
* transaction is done. Right now, though, this is how iOS does it, and we should probably
* update the JS and native code and make this change at the same time.
*
* TODO(5279396): Make JS UI library explicitly notify the native UI module of the end of a UI
* transaction using a standard native call
*/
@Override
public void onBatchComplete() {
int batchId = mBatchId;
mBatchId++;
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "onBatchCompleteUI")
.arg("BatchId", batchId)
.flush();
try {
mUIImplementation.dispatchViewUpdates(mEventDispatcher, batchId);
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
}