mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Drop support for webworkers
Reviewed By: AaaChiuuu Differential Revision: D4916449 fbshipit-source-id: a447233d3b7cfee98db2ce00f1c0505d513e2429
This commit is contained in:
committed by
Facebook Github Bot
parent
a20882f62e
commit
34bc6bd2ae
@@ -13,8 +13,6 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ExecutorToken;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@@ -38,29 +36,6 @@ public @interface ReactModule {
|
||||
*/
|
||||
boolean canOverrideExistingModule() default false;
|
||||
|
||||
/**
|
||||
* In order to support web workers, a module must be aware that it can be invoked from multiple
|
||||
* different JS VMs. Supporting web workers means recognizing things like:
|
||||
*
|
||||
* 1) ids (e.g. timer ids, request ids, etc.) may only unique on a per-VM basis
|
||||
* 2) the module needs to make sure to enqueue callbacks and JS module calls to the correct VM
|
||||
*
|
||||
* In order to facilitate this, modules that support web workers will have all their @ReactMethod-
|
||||
* annotated methods passed a {@link ExecutorToken} as the first parameter before any arguments
|
||||
* from JS. This ExecutorToken internally maps to a specific JS VM and can be used by the
|
||||
* framework to route calls appropriately. In order to make JS module calls correctly, start using
|
||||
* the version of {@link ReactContext#getJSModule(ExecutorToken, Class)} that takes an
|
||||
* ExecutorToken. It will ensure that any calls you dispatch to the returned object will go to
|
||||
* the right VM. For Callbacks, you don't have to do anything special -- the framework
|
||||
* automatically tags them with the correct ExecutorToken when the are created.
|
||||
*
|
||||
* Note: even though calls can come from multiple JS VMs on multiple threads, calls to this module
|
||||
* will still only occur on a single thread.
|
||||
*
|
||||
* @return whether this module supports web workers.
|
||||
*/
|
||||
boolean supportsWebWorkers() default false;
|
||||
|
||||
/**
|
||||
* Whether this module needs to be loaded immediately.
|
||||
*/
|
||||
|
||||
@@ -10,19 +10,16 @@ public class ReactModuleInfo {
|
||||
|
||||
private final String mName;
|
||||
private final boolean mCanOverrideExistingModule;
|
||||
private final boolean mSupportsWebWorkers;
|
||||
private final boolean mNeedsEagerInit;
|
||||
private final boolean mHasConstants;
|
||||
|
||||
public ReactModuleInfo(
|
||||
String name,
|
||||
boolean canOverrideExistingModule,
|
||||
boolean supportsWebWorkers,
|
||||
boolean needsEagerInit,
|
||||
boolean hasConstants) {
|
||||
mName = name;
|
||||
mCanOverrideExistingModule = canOverrideExistingModule;
|
||||
mSupportsWebWorkers = supportsWebWorkers;
|
||||
mNeedsEagerInit = needsEagerInit;
|
||||
mHasConstants = hasConstants;
|
||||
}
|
||||
@@ -35,10 +32,6 @@ public class ReactModuleInfo {
|
||||
return mCanOverrideExistingModule;
|
||||
}
|
||||
|
||||
public boolean supportsWebWorkers() {
|
||||
return mSupportsWebWorkers;
|
||||
}
|
||||
|
||||
public boolean needsEagerInit() {
|
||||
return mNeedsEagerInit;
|
||||
}
|
||||
|
||||
-1
@@ -175,7 +175,6 @@ public class ReactModuleSpecProcessor extends AbstractProcessor {
|
||||
.append("new ReactModuleInfo(")
|
||||
.append("\"").append(reactModule.name()).append("\"").append(", ")
|
||||
.append(reactModule.canOverrideExistingModule()).append(", ")
|
||||
.append(reactModule.supportsWebWorkers()).append(", ")
|
||||
.append(reactModule.needsEagerInit()).append(", ")
|
||||
.append(hasConstants)
|
||||
.append(")")
|
||||
|
||||
Reference in New Issue
Block a user