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


Java Assertions.assertCondition方法代码示例

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


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

示例1: dispatchCancelEvent

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
private void dispatchCancelEvent(MotionEvent androidEvent, EventDispatcher eventDispatcher) {
  // This means the gesture has already ended, via some other CANCEL or UP event. This is not
  // expected to happen very often as it would mean some child View has decided to intercept the
  // touch stream and start a native gesture only upon receiving the UP/CANCEL event.
  if (mTargetTag == -1) {
    FLog.w(
      ReactConstants.TAG,
      "Can't cancel already finished gesture. Is a child View trying to start a gesture from " +
        "an UP/CANCEL event?");
    return;
  }

  Assertions.assertCondition(
    !mChildIsHandlingNativeGesture,
    "Expected to not have already sent a cancel for this gesture");
  Assertions.assertNotNull(eventDispatcher).dispatchEvent(
    TouchEvent.obtain(
      mTargetTag,
      TouchEventType.CANCEL,
      androidEvent,
      mGestureStartTime,
      mTargetCoordinates[0],
      mTargetCoordinates[1],
      mTouchEventCoalescingKeyHelper));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:26,代码来源:JSTouchDispatcher.java

示例2: attach

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
void attach(BitmapUpdateListener listener) {
  mBitmapUpdateListener = listener;

  mAttachCounter++;
  if (mAttachCounter != 1) {
    // this is a secondary attach, ignore it, only updating Bitmap boundaries if needed.
    Bitmap bitmap = getBitmap();
    if (bitmap != null) {
      listener.onSecondaryAttach(bitmap);
    }
    return;
  }

  listener.onImageLoadEvent(ImageLoadEvent.ON_LOAD_START);

  Assertions.assertCondition(mDataSource == null);
  Assertions.assertCondition(mImageRef == null);

  // Submit the request
  ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();
  mDataSource = imagePipeline.fetchDecodedImage(mImageRequest, RCTImageView.getCallerContext());
  mDataSource.subscribe(this, UiThreadImmediateExecutorService.getInstance());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:PipelineRequestHelper.java

示例3: addViewWithSubviewClippingEnabled

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
void addViewWithSubviewClippingEnabled(View child, int index, LayoutParams params) {
  Assertions.assertCondition(mRemoveClippedSubviews);
  Assertions.assertNotNull(mClippingRect);
  Assertions.assertNotNull(mAllChildren);
  addInArray(child, index);
  // we add view as "clipped" and then run {@link #updateSubviewClipStatus} to conditionally
  // attach it
  int clippedSoFar = 0;
  for (int i = 0; i < index; i++) {
    if (mAllChildren[i].getParent() == null) {
      clippedSoFar++;
    }
  }
  updateSubviewClipStatus(mClippingRect, index, clippedSoFar);
  child.addOnLayoutChangeListener(mChildrenLayoutChangeListener);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ReactViewGroup.java

示例4: startReactApplication

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
/**
 * Schedule rendering of the react component rendered by the JS application from the given JS
 * module (@{param moduleName}) using provided {@param reactInstanceManager} to attach to the
 * JS context of that manager. Extra parameter {@param launchOptions} can be used to pass initial
 * properties for the react component.
 */
public void startReactApplication(
    ReactInstanceManager reactInstanceManager,
    String moduleName,
    @Nullable Bundle launchOptions) {
  UiThreadUtil.assertOnUiThread();

  // TODO(6788889): Use POJO instead of bundle here, apparently we can't just use WritableMap
  // here as it may be deallocated in native after passing via JNI bridge, but we want to reuse
  // it in the case of re-creating the catalyst instance
  Assertions.assertCondition(
      mReactInstanceManager == null,
      "This root view has already been attached to a catalyst instance manager");

  mReactInstanceManager = reactInstanceManager;
  mJSModuleName = moduleName;
  mLaunchOptions = launchOptions;

  if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
    mReactInstanceManager.createReactContextInBackground();
  }

  // We need to wait for the initial onMeasure, if this view has not yet been measured, we set which
  // will make this view startReactApplication itself to instance manager once onMeasure is called.
  if (mWasMeasured) {
    attachToReactInstanceManager();
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:34,代码来源:ReactRootView.java

示例5: assertNow

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
public void assertNow() {
  Thread current = Thread.currentThread();
  if (mThread == null) {
    mThread = current;
  }
  Assertions.assertCondition(mThread == current);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:SingleThreadAsserter.java

示例6: postFrameCallback

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
public void postFrameCallback(CallbackType type, ChoreographerCompat.FrameCallback frameCallback) {
  UiThreadUtil.assertOnUiThread();
  mCallbackQueues[type.getOrder()].addLast(frameCallback);
  mTotalCallbacks++;
  Assertions.assertCondition(mTotalCallbacks > 0);
  if (!mHasPostedCallback) {
    mChoreographer.postFrameCallback(mReactChoreographerDispatcher);
    mHasPostedCallback = true;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:ReactChoreographer.java

示例7: recreateReactContextInBackground

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
/**
 * Recreate the react application and context. This should be called if configuration has
 * changed or the developer has requested the app to be reloaded. It should only be called after
 * an initial call to createReactContextInBackground.
 *
 * Called from UI thread.
 */
public void recreateReactContextInBackground() {
  Assertions.assertCondition(
      mHasStartedCreatingInitialContext,
      "recreateReactContextInBackground should only be called after the initial " +
          "createReactContextInBackground call.");
  recreateReactContextInBackgroundInner();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:ReactInstanceManager.java

示例8: setupReactContext

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
private void setupReactContext(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_END);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "setupReactContext");
  UiThreadUtil.assertOnUiThread();
  Assertions.assertCondition(mCurrentReactContext == null);
  mCurrentReactContext = Assertions.assertNotNull(reactContext);
  CatalystInstance catalystInstance =
      Assertions.assertNotNull(reactContext.getCatalystInstance());

  catalystInstance.initialize();
  mDevSupportManager.onNewReactContextCreated(reactContext);
  mMemoryPressureRouter.addMemoryPressureListener(catalystInstance);
  moveReactContextToCurrentLifecycleState();

  for (ReactRootView rootView : mAttachedRootViews) {
    attachMeasuredRootViewToInstance(rootView, catalystInstance);
  }

  ReactInstanceEventListener[] listeners =
    new ReactInstanceEventListener[mReactInstanceEventListeners.size()];
  listeners = mReactInstanceEventListeners.toArray(listeners);

  for (ReactInstanceEventListener listener : listeners) {
    listener.onReactContextInitialized(reactContext);
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_END);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:30,代码来源:ReactInstanceManager.java

示例9: addNativeChildAt

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
/**
 * Adds a child that the native view hierarchy will have at this index in the native view
 * corresponding to this node.
 */
public final void addNativeChildAt(ReactShadowNode child, int nativeIndex) {
  Assertions.assertCondition(!mIsLayoutOnly);
  Assertions.assertCondition(!child.mIsLayoutOnly);

  if (mNativeChildren == null) {
    mNativeChildren = new ArrayList<>(4);
  }

  mNativeChildren.add(nativeIndex, child);
  child.mNativeParent = this;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:ReactShadowNode.java

示例10: removeAllViewsWithSubviewClippingEnabled

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
void removeAllViewsWithSubviewClippingEnabled() {
  Assertions.assertCondition(mRemoveClippedSubviews);
  Assertions.assertNotNull(mAllChildren);
  for (int i = 0; i < mAllChildrenCount; i++) {
    mAllChildren[i].removeOnLayoutChangeListener(mChildrenLayoutChangeListener);
  }
  removeAllViewsInLayout();
  mAllChildrenCount = 0;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:10,代码来源:ReactViewGroup.java

示例11: finalize

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
@Override
protected void finalize() throws Throwable {
  super.finalize();
  Assertions.assertCondition(
    !mIsAttachedToInstance,
    "The application this ReactRootView was rendering was not unmounted before the ReactRootView " +
      "was garbage collected. This usually means that your application is leaking large amounts of " +
      "memory. To solve this, make sure to call ReactRootView#unmountReactApplication in the onDestroy() " +
      "of your hosting Activity or in the onDestroyView() of your hosting Fragment.");
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:ReactRootView.java

示例12: setNativeModulesQueueThreadSpec

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
public Builder setNativeModulesQueueThreadSpec(MessageQueueThreadSpec spec) {
  Assertions.assertCondition(
      mNativeModulesQueueSpec == null,
      "Setting native modules queue spec multiple times!");
  mNativeModulesQueueSpec = spec;
  return this;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:ReactQueueConfigurationSpec.java

示例13: buildArgumentExtractors

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
private ArgumentExtractor[] buildArgumentExtractors(Class[] paramTypes) {
  // Modules that support web workers are expected to take an ExecutorToken as the first
  // parameter to all their @ReactMethod-annotated methods. We compensate for that here.
  int executorTokenOffset = 0;
  if (mModuleWrapper.supportsWebWorkers()) {
    if (paramTypes[0] != ExecutorToken.class) {
      throw new RuntimeException(
        "Module " + mModuleWrapper.getName() + " supports web workers, but " + mMethod.getName() +
          "does not take an ExecutorToken as its first parameter.");
    }
    executorTokenOffset = 1;
  }

  ArgumentExtractor[] argumentExtractors = new ArgumentExtractor[paramTypes.length - executorTokenOffset];
  for (int i = 0; i < paramTypes.length - executorTokenOffset; i += argumentExtractors[i].getJSArgumentsNeeded()) {
    int paramIndex = i + executorTokenOffset;
    Class argumentClass = paramTypes[paramIndex];
    if (argumentClass == Boolean.class || argumentClass == boolean.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_BOOLEAN;
    } else if (argumentClass == Integer.class || argumentClass == int.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_INTEGER;
    } else if (argumentClass == Double.class || argumentClass == double.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_DOUBLE;
    } else if (argumentClass == Float.class || argumentClass == float.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_FLOAT;
    } else if (argumentClass == String.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_STRING;
    } else if (argumentClass == Callback.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_CALLBACK;
    } else if (argumentClass == Promise.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_PROMISE;
      Assertions.assertCondition(
        paramIndex == paramTypes.length - 1, "Promise must be used as last parameter only");
    } else if (argumentClass == ReadableMap.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_MAP;
    } else if (argumentClass == ReadableArray.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_ARRAY;
    } else if (argumentClass == Dynamic.class) {
      argumentExtractors[i] = ARGUMENT_EXTRACTOR_DYNAMIC;
    } else {
      throw new RuntimeException(
        "Got unknown argument class: " + argumentClass.getSimpleName());
    }
  }
  return argumentExtractors;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:47,代码来源:JavaMethodWrapper.java

示例14: transitionLayoutOnlyViewToNativeView

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
private void transitionLayoutOnlyViewToNativeView(
    ReactShadowNode node,
    @Nullable ReactStylesDiffMap props) {
  ReactShadowNode parent = node.getParent();
  if (parent == null) {
    node.setIsLayoutOnly(false);
    return;
  }

  // First, remove the node from its parent. This causes the parent to update its native children
  // count. The removeNodeFromParent call will cause all the view's children to be detached from
  // their native parent.
  int childIndex = parent.indexOf(node);
  parent.removeChildAt(childIndex);
  removeNodeFromParent(node, false);

  node.setIsLayoutOnly(false);

  // Create the view since it doesn't exist in the native hierarchy yet
  mUIViewOperationQueue.enqueueCreateView(
      node.getRootNode().getThemedContext(),
      node.getReactTag(),
      node.getViewClass(),
      props);

  // Add the node and all its children as if we are adding a new nodes
  parent.addChildAt(node, childIndex);
  addNodeToNode(parent, node, childIndex);
  for (int i = 0; i < node.getChildCount(); i++) {
    addNodeToNode(node, node.getChildAt(i), i);
  }

  // Update layouts since the children of the node were offset by its x/y position previously.
  // Bit of a hack: we need to update the layout of this node's children now that it's no longer
  // layout-only, but we may still receive more layout updates at the end of this batch that we
  // don't want to ignore.
  Assertions.assertCondition(mTagsWithLayoutVisited.size() == 0);
  applyLayoutBase(node);
  for (int i = 0; i < node.getChildCount(); i++) {
    applyLayoutBase(node.getChildAt(i));
  }
  mTagsWithLayoutVisited.clear();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:44,代码来源:NativeViewHierarchyOptimizer.java

示例15: setJSQueueThreadSpec

import com.facebook.infer.annotation.Assertions; //导入方法依赖的package包/类
public Builder setJSQueueThreadSpec(MessageQueueThreadSpec spec) {
  Assertions.assertCondition(mJSQueueSpec == null, "Setting JS queue multiple times!");
  mJSQueueSpec = spec;
  return this;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:6,代码来源:ReactQueueConfigurationSpec.java


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