Summary: Fix for crash introduced by D17282188; doesn't cleanly revert, so just reverting this part

Reviewed By: JoshuaGross, RSNara

Differential Revision: D17505827

fbshipit-source-id: 3232285c0f15dabeb819f8806ad35d4ec83a1e53
This commit is contained in:
Emily Janzer 2019-09-20 13:51:37 -07:00 коммит произвёл Facebook Github Bot
Родитель d34bc5fa64
Коммит ed6a3a6c74
2 изменённых файлов: 11 добавлений и 32 удалений

Просмотреть файл

@ -73,7 +73,7 @@ public class JavaTimerManager {
}
if (mTimersToCall != null) {
mJSTimers.callTimers(mTimersToCall);
mReactApplicationContext.getJSModule(JSTimers.class).callTimers(mTimersToCall);
mTimersToCall = null;
}
@ -131,7 +131,9 @@ public class JavaTimerManager {
}
if (sendIdleEvents) {
mJSTimers.callIdleCallbacks(absoluteFrameStartTime);
mReactApplicationContext
.getJSModule(JSTimers.class)
.callIdleCallbacks(absoluteFrameStartTime);
}
mCurrentIdleCallbackRunnable = null;
@ -143,7 +145,6 @@ public class JavaTimerManager {
}
private final ReactApplicationContext mReactApplicationContext;
private final JSTimers mJSTimers;
private final ReactChoreographer mReactChoreographer;
private final DevSupportManager mDevSupportManager;
private final Object mTimerGuard = new Object();
@ -161,11 +162,9 @@ public class JavaTimerManager {
public JavaTimerManager(
ReactApplicationContext reactContext,
JSTimers jsTimers,
ReactChoreographer reactChoreographer,
DevSupportManager devSupportManager) {
mReactApplicationContext = reactContext;
mJSTimers = jsTimers;
mReactChoreographer = reactChoreographer;
mDevSupportManager = devSupportManager;
@ -318,9 +317,11 @@ public class JavaTimerManager {
if (mDevSupportManager.getDevSupportEnabled()) {
long driftTime = Math.abs(remoteTime - deviceTime);
if (driftTime > 60000) {
mJSTimers.emitTimeDriftWarning(
"Debugger and device times have drifted by more than 60s. Please correct this by "
+ "running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your debugger machine.");
mReactApplicationContext
.getJSModule(JSTimers.class)
.emitTimeDriftWarning(
"Debugger and device times have drifted by more than 60s. Please correct this by "
+ "running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your debugger machine.");
}
}
@ -329,7 +330,7 @@ public class JavaTimerManager {
if (duration == 0 && !repeat) {
WritableArray timerToCall = Arguments.createArray();
timerToCall.pushInt(callbackID);
mJSTimers.callTimers(timerToCall);
mReactApplicationContext.getJSModule(JSTimers.class).callTimers(timerToCall);
return;
}

Просмотреть файл

@ -10,7 +10,6 @@ import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.jstasks.HeadlessJsTaskContext;
import com.facebook.react.jstasks.HeadlessJsTaskEventListener;
@ -28,29 +27,8 @@ public final class TimingModule extends ReactContextBaseJavaModule
public TimingModule(ReactApplicationContext reactContext, DevSupportManager devSupportManager) {
super(reactContext);
JSTimers jsTimersProxy =
new JSTimers() {
@Override
public void callTimers(WritableArray timerIDs) {
getReactApplicationContext().getJSModule(JSTimers.class).callTimers(timerIDs);
}
@Override
public void callIdleCallbacks(double frameTime) {
getReactApplicationContext().getJSModule(JSTimers.class).callIdleCallbacks(frameTime);
}
@Override
public void emitTimeDriftWarning(String warningMessage) {
getReactApplicationContext()
.getJSModule(JSTimers.class)
.emitTimeDriftWarning(warningMessage);
}
};
mJavaTimerManager =
new JavaTimerManager(
reactContext, jsTimersProxy, ReactChoreographer.getInstance(), devSupportManager);
new JavaTimerManager(reactContext, ReactChoreographer.getInstance(), devSupportManager);
}
@Override