当前位置: 首页>>代码示例>>Java>>正文


Java Systrace.beginSection方法代码示例

本文整理汇总了Java中com.facebook.systrace.Systrace.beginSection方法的典型用法代码示例。如果您正苦于以下问题:Java Systrace.beginSection方法的具体用法?Java Systrace.beginSection怎么用?Java Systrace.beginSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.systrace.Systrace的用法示例。


在下文中一共展示了Systrace.beginSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAllViewManagers

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
/**
 * Uses configured {@link ReactPackage} instances to create all view managers.
 */
public List<ViewManager> createAllViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
  try {
    List<ViewManager> allViewManagers = new ArrayList<>();
    for (ReactPackage reactPackage : mPackages) {
      allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
    }
    return allViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactInstanceManager.java

示例2: notifyJSInstanceInitialized

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
void notifyJSInstanceInitialized() {
  mReactApplicationContext.assertOnNativeModulesQueueThread("From version React Native v0.44, " +
    "native modules are explicitly not initialized on the UI thread. See " +
    "https://github.com/facebook/react-native/wiki/Breaking-Changes#d4611211-reactnativeandroidbreaking-move-nativemodule-initialization-off-ui-thread---aaachiuuu " +
    " for more details.");
  ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
  Systrace.beginSection(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
      "NativeModuleRegistry_notifyJSInstanceInitialized");
  try {
    for (ModuleHolder module : mModules.values()) {
      module.initialize();
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:NativeModuleRegistry.java

示例3: attachMeasuredRootViewToInstance

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
private void attachMeasuredRootViewToInstance(
    ReactRootView rootView,
    CatalystInstance catalystInstance) {
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachMeasuredRootViewToInstance");
  UiThreadUtil.assertOnUiThread();

  // Reset view content as it's going to be populated by the application content from JS
  rootView.removeAllViews();
  rootView.setId(View.NO_ID);

  UIManagerModule uiManagerModule = catalystInstance.getNativeModule(UIManagerModule.class);
  int rootTag = uiManagerModule.addMeasuredRootView(rootView);
  rootView.setRootViewTag(rootTag);
  @Nullable Bundle launchOptions = rootView.getLaunchOptions();
  WritableMap initialProps = Arguments.makeNativeMap(launchOptions);
  String jsAppModuleName = rootView.getJSModuleName();

  WritableNativeMap appParams = new WritableNativeMap();
  appParams.putDouble("rootTag", rootTag);
  appParams.putMap("initialProps", initialProps);
  catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
  rootView.onAttachedToReactInstance();
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:ReactInstanceManager.java

示例4: doFrameGuarded

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void doFrameGuarded(long frameTimeNanos) {
  if (mIsInIllegalUIState) {
    FLog.w(
      ReactConstants.TAG,
      "Not flushing pending UI operations because of previously thrown Exception");
    return;
  }

  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "dispatchNonBatchedUIOperations");
  try {
    dispatchPendingNonBatchedOperations(frameTimeNanos);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }

  flushPendingBatches();

  ReactChoreographer.getInstance().postFrameCallback(
    ReactChoreographer.CallbackType.DISPATCH_UI, this);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:UIViewOperationQueue.java

示例5: doFrame

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void doFrame(long frameTimeNanos) {
  UiThreadUtil.assertOnUiThread();

  if (mShouldStop) {
    mIsPosted = false;
  } else {
    post();
  }

  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ScheduleDispatchFrameCallback");
  try {
    moveStagedEventsToDispatchQueue();

    if (mEventsToDispatchSize > 0 && !mHasDispatchScheduled) {
      mHasDispatchScheduled = true;
      Systrace.startAsyncFlow(
          Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
          "ScheduleDispatchFrameCallback",
          mHasDispatchScheduledCount);
      mReactContext.runOnJSQueueThread(mDispatchEventsRunnable);
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:EventDispatcher.java

示例6: createUIManager

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
private UIManagerModule createUIManager(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "createUIManagerModule");
  try {
    List<ViewManager> viewManagersList = mReactInstanceManager.createAllViewManagers(
      reactContext);
    return new UIManagerModule(
      reactContext,
      viewManagersList,
      mUIImplementationProvider,
      mLazyViewManagersEnabled);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:CoreModulesPackage.java

示例7: findMethods

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
private void findMethods() {
  if (mMethods == null) {
    Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "findMethods");
    mMethods = new HashMap<>();

    Method[] targetMethods = getClass().getDeclaredMethods();
    for (Method targetMethod : targetMethods) {
      ReactMethod annotation = targetMethod.getAnnotation(ReactMethod.class);
      if (annotation != null) {
        String methodName = targetMethod.getName();
        if (mMethods.containsKey(methodName)) {
          // We do not support method overloading since js sees a function as an object regardless
          // of number of params.
          throw new IllegalArgumentException(
            "Java Module " + getName() + " method name already registered: " + methodName);
        }
        mMethods.put(
            methodName,
            new JavaMethod(targetMethod,
          annotation.isBlockingSynchronousMethod()));
      }
    }
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:26,代码来源:BaseJavaModule.java

示例8: onBatchComplete

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void onBatchComplete() {
  mReactQueueConfiguration.getNativeModulesQueueThread().assertIsOnThread();

  // The bridge may have been destroyed due to an exception during the batch. In that case
  // native modules could be in a bad state so we don't want to call anything on them. We
  // still want to trigger the debug listener since it allows instrumentation tests to end and
  // check their assertions without waiting for a timeout.
  synchronized (mJSToJavaCallsTeardownLock) {
    if (!mDestroyed) {
      Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "onBatchComplete");
      try {
        mJavaRegistry.onBatchComplete();
      } finally {
        Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
      }
    }
  }

  decrementPendingJSCalls();
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:22,代码来源:CatalystInstanceImpl.java

示例9: onExecutorUnregistered

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void onExecutorUnregistered(ExecutorToken executorToken) {
  mReactQueueConfiguration.getNativeModulesQueueThread().assertIsOnThread();

  // Since onCatalystInstanceDestroy happens on the UI thread, we don't want to also execute
  // this callback on the native modules thread at the same time. Longer term, onCatalystInstanceDestroy
  // should probably be executed on the native modules thread as well instead.
  synchronized (mJSToJavaCallsTeardownLock) {
    if (!mDestroyed) {
      Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "onExecutorUnregistered");
      try {
        mJavaRegistry.onExecutorUnregistered(executorToken);
      } finally {
        Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
      }
    }
  }
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:19,代码来源:CatalystInstanceImpl.java

示例10: writeModuleDescriptions

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
void writeModuleDescriptions(JsonGenerator jg) throws IOException {
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateJSON");
  try {
    jg.writeStartObject();
    for (ModuleDefinition moduleDef : mModuleTable) {
      jg.writeObjectFieldStart(moduleDef.name);
      jg.writeNumberField("moduleID", moduleDef.id);
      jg.writeBooleanField("supportsWebWorkers", moduleDef.target.supportsWebWorkers());
      jg.writeObjectFieldStart("methods");
      for (int i = 0; i < moduleDef.methods.size(); i++) {
        MethodRegistration method = moduleDef.methods.get(i);
        jg.writeObjectFieldStart(method.name);
        jg.writeNumberField("methodID", i);
        jg.writeStringField("type", method.method.getType());
        jg.writeEndObject();
      }
      jg.writeEndObject();
      moduleDef.target.writeConstantsField(jg, "constants");
      jg.writeEndObject();
    }
    jg.writeEndObject();
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:26,代码来源:NativeModuleRegistry.java

示例11: doFrameGuarded

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void doFrameGuarded(long frameTimeNanos) {
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "dispatchNonBatchedUIOperations");
  try {
    dispatchPendingNonBatchedOperations(frameTimeNanos);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }

  synchronized (mDispatchRunnablesLock) {
    for (int i = 0; i < mDispatchUIRunnables.size(); i++) {
      mDispatchUIRunnables.get(i).run();
    }
    mDispatchUIRunnables.clear();
  }

  ReactChoreographer.getInstance().postFrameCallback(
    ReactChoreographer.CallbackType.DISPATCH_UI, this);
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:20,代码来源:UIViewOperationQueue.java

示例12: createAllViewManagers

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
/**
 * Uses configured {@link ReactPackage} instances to create all view managers
 */
@Override
public List<ViewManager> createAllViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
  try {
    List<ViewManager> allViewManagers = new ArrayList<>();
    for (ReactPackage reactPackage : mPackages) {
      allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
    }
    return allViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:20,代码来源:XReactInstanceManagerImpl.java

示例13: run

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@Override
public void run() {
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "DispatchEventsRunnable");
  try {
    Systrace.endAsyncFlow(
        Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
        "ScheduleDispatchFrameCallback",
        mHasDispatchScheduledCount);
    mHasDispatchScheduled = false;
    mHasDispatchScheduledCount++;
    Assertions.assertNotNull(mRCTEventEmitter);
    synchronized (mEventsToDispatchLock) {
      // We avoid allocating an array and iterator, and "sorting" if we don't need to.
      // This occurs when the size of mEventsToDispatch is zero or one.
      if (mEventsToDispatchSize > 1) {
        Arrays.sort(mEventsToDispatch, 0, mEventsToDispatchSize, EVENT_COMPARATOR);
      }
      for (int eventIdx = 0; eventIdx < mEventsToDispatchSize; eventIdx++) {
        Event event = mEventsToDispatch[eventIdx];
        // Event can be null if it has been coalesced into another event.
        if (event == null) {
          continue;
        }
        Systrace.endAsyncFlow(
            Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
            event.getEventName(),
            event.getUniqueID());
        event.dispatch(mRCTEventEmitter);
        event.dispose();
      }
      clearEventsToDispatch();
      mEventCookieToLastEventIdx.clear();
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:38,代码来源:EventDispatcher.java

示例14: createConstants

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
private static Map<String, Object> createConstants(
  List<ViewManager> viewManagerList,
  boolean lazyViewManagersEnabled) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "CreateUIManagerConstants");
  try {
    return UIManagerModuleConstantsHelper.createConstants(
      viewManagerList,
      lazyViewManagersEnabled);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:UIManagerModule.java

示例15: findMethods

import com.facebook.systrace.Systrace; //导入方法依赖的package包/类
@DoNotStrip
private void findMethods() {
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "findMethods");
  Set<String> methodNames = new HashSet<>();

  Method[] targetMethods = mModuleClass.getDeclaredMethods();
  for (Method targetMethod : targetMethods) {
    ReactMethod annotation = targetMethod.getAnnotation(ReactMethod.class);
    if (annotation != null) {
      String methodName = targetMethod.getName();
      if (methodNames.contains(methodName)) {
        // We do not support method overloading since js sees a function as an object regardless
        // of number of params.
        throw new IllegalArgumentException(
          "Java Module " + getName() + " method name already registered: " + methodName);
      }
      MethodDescriptor md = new MethodDescriptor();
      JavaMethodWrapper method = new JavaMethodWrapper(this, targetMethod, annotation.isBlockingSynchronousMethod());
      md.name = methodName;
      md.type = method.getType();
      if (md.type == BaseJavaModule.METHOD_TYPE_SYNC) {
        md.signature = method.getSignature();
        md.method = targetMethod;
      }
      mMethods.add(method);
      mDescs.add(md);
    }
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:31,代码来源:JavaModuleWrapper.java


注:本文中的com.facebook.systrace.Systrace.beginSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。