com.eclipsesource.v8.V8.getV8RuntimePtr()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中com.eclipsesource.v8.V8.getV8RuntimePtr()方法的一些代码示例,展示了V8.getV8RuntimePtr()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。V8.getV8RuntimePtr()方法的具体详情如下:
包路径:com.eclipsesource.v8.V8
类名称:V8
方法名:getV8RuntimePtr

V8.getV8RuntimePtr介绍

暂无

代码示例

代码示例来源:origin: eclipsesource/J2V8

public V8ArrayBuffer(final V8 v8, ByteBuffer byteBuffer) {
  super(v8);
  if (byteBuffer == null) {
    byteBuffer = ByteBuffer.allocateDirect(0);
  }
  if (!byteBuffer.isDirect()) {
    throw new IllegalArgumentException("ByteBuffer must be a allocated as a direct ByteBuffer");
  }
  initialize(v8.getV8RuntimePtr(), byteBuffer);
  this.byteBuffer = byteBuffer;
  byteBuffer.order(ByteOrder.nativeOrder());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Creates a new V8ArrayBuffer on a given V8Runtime with a
 * given capacity.
 *
 * @param v8 The runtime on which to create the ArrayBuffer
 * @param capacity The capacity of the buffer
 */
public V8ArrayBuffer(final V8 v8, final int capacity) {
  super(v8);
  initialize(v8.getV8RuntimePtr(), capacity);
  byteBuffer = v8.createV8ArrayBufferBackingStore(v8.getV8RuntimePtr(), objectHandle, capacity);
  byteBuffer.order(ByteOrder.nativeOrder());
}

代码示例来源:origin: eclipsesource/J2V8

void registerVoidCallback(final JavaVoidCallback callback, final long objectHandle, final String jsFunctionName) {
  MethodDescriptor methodDescriptor = new MethodDescriptor();
  methodDescriptor.voidCallback = callback;
  long methodID = registerJavaMethod(getV8RuntimePtr(), objectHandle, jsFunctionName, true);
  functionRegistry.put(methodID, methodDescriptor);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Indicates to V8 that the system is low on memory.
 * V8 may use this to attempt to recover space by running
 * the garbage collector.
 */
public void lowMemoryNotification() {
  checkThread();
  lowMemoryNotification(getV8RuntimePtr());
}

代码示例来源:origin: eclipsesource/J2V8

protected V8Object(final V8 v8, final Object data) {
  super(v8);
  if (v8 != null) {
    this.v8.checkThread();
    initialize(this.v8.getV8RuntimePtr(), data);
  }
}

代码示例来源:origin: eclipsesource/J2V8

void registerCallback(final JavaCallback callback, final long objectHandle, final String jsFunctionName) {
  long methodID = registerJavaMethod(getV8RuntimePtr(), objectHandle, jsFunctionName, false);
  createAndRegisterMethodDescriptor(callback, methodID);
}

代码示例来源:origin: eclipsesource/J2V8

void registerCallback(final Object object, final Method method, final long objectHandle, final String jsFunctionName, final boolean includeReceiver) {
  MethodDescriptor methodDescriptor = new MethodDescriptor();
  methodDescriptor.object = object;
  methodDescriptor.method = method;
  methodDescriptor.includeReceiver = includeReceiver;
  long methodID = registerJavaMethod(getV8RuntimePtr(), objectHandle, jsFunctionName, isVoidMethod(method));
  functionRegistry.put(methodID, methodDescriptor);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns all the keys associated with this JavaScript Object.
 * Keys associated with the objects prototype are not returned.
 *
 * @return The keys associated with this JavaScript Object.
 */
public String[] getKeys() {
  v8.checkThread();
  checkReleased();
  return v8.getKeys(v8.getV8RuntimePtr(), objectHandle);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Gets the value at a given index as a Java Object. Primitives are boxed.
 *
 * @param index The index to get the value at.
 *
 * @return The value at the given index.
 */
public Object get(final int index) {
  v8.checkThread();
  checkReleased();
  return v8.arrayGet(v8.getV8RuntimePtr(), V8_OBJECT, objectHandle, index);
}

代码示例来源:origin: eclipsesource/J2V8

@Override
public void close() {
  v8.checkThread();
  if (!released) {
    try {
      v8.releaseObjRef(this);
    } finally {
      released = true;
      v8.release(v8.getV8RuntimePtr(), objectHandle);
    }
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Associate NULL with the given key.
 *
 * @param key The key to associate NULL with.
 *
 * @return The receiver.
 */
public V8Object addNull(final String key) {
  v8.checkThread();
  checkReleased();
  v8.addNull(v8.getV8RuntimePtr(), objectHandle, key);
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * If {@link V8Value#setWeak()} has been called on this Object, this method
 * will return true. Otherwise it will return false.
 *
 * @return Returns true if this object has been set 'Weak', return false otherwise.
 */
public boolean isWeak() {
  v8.checkThread();
  v8.checkReleased();
  return v8.isWeak(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the type of element at this given index.
 *
 * @param index The index at which to lookup the type of.
 *
 * @return The type of the element at the index.
 */
public int getType(final int index) {
  v8.checkThread();
  checkReleased();
  return v8.getType(v8.getV8RuntimePtr(), getHandle(), index);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Gets the type of the array. Returns a 'type' if all the elements in the array
 * have the same type, otherwise UNDEFINED is returned.
 *
 * @return The type of all the elements of the array, or UNDEFINED if they
 * are not all the same type.
 */
public int getType() {
  v8.checkThread();
  checkReleased();
  return v8.getArrayType(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the length of this array.
 *
 * @return The length of the array.
 */
public int length() {
  v8.checkThread();
  checkReleased();
  return v8.arrayGetSize(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

@Override
public int hashCode() {
  v8.checkThread();
  checkReleased();
  return v8.identityHash(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Pushes null to the next available spot in the Array. In
 * particular, this[length] = null;
 *
 * @return The receiver.
 */
public V8Array pushNull() {
  v8.checkThread();
  checkReleased();
  v8.addArrayNullItem(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Pushes undefined to the next available spot in the Array. In
 * particular, this[length] = undefined;
 *
 * @return The receiver.
 */
public V8Array pushUndefined() {
  v8.checkThread();
  checkReleased();
  v8.addArrayUndefinedItem(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Determine if a key/value pair with this key exists in
 * the Object.
 *
 * @param key The key to check
 * @return True if the key exists, false otherwise.
 */
public boolean contains(final String key) {
  v8.checkThread();
  checkReleased();
  checkKey(key);
  return v8.contains(v8.getV8RuntimePtr(), objectHandle, key);
}

代码示例来源:origin: eclipsesource/J2V8

@Override
public String toString() {
  if (isReleased() || v8.isReleased()) {
    return "[Object released]";
  }
  v8.checkThread();
  return v8.toString(v8.getV8RuntimePtr(), getHandle());
}

相关文章

微信公众号

最新文章

更多

V8类方法