public Timing(ReactApplicationContext reactContext, DevSupportManager devSupportManager) { super(reactContext); mDevSupportManager = devSupportManager; // We store timers sorted by finish time. mTimers = new PriorityQueue<Timer>( 11, // Default capacity: for some reason they don't expose a (Comparator) constructor new Comparator<Timer>() { @Override public int compare(Timer lhs, Timer rhs) { long diff = lhs.mTargetTime - rhs.mTargetTime; if (diff == 0) { return 0; } else if (diff < 0) { return -1; } else { return 1; } } }); mTimerIdsToTimers = new HashMap<>(); mSendIdleEventsExecutorTokens = new HashSet<>(); mIdleCallbackContextsToCall = new ArrayList<>(); }
/** * Timing module needs to be created on the main thread so that it gets the correct Choreographer. */ protected Timing createTimingModule() { final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>(); UiThreadUtil.runOnUiThread( new Runnable() { @Override public void run() { Timing timing = new Timing(getContext(), mock(DevSupportManager.class)); simpleSettableFuture.set(timing); } }); try { return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new RuntimeException(e); } }
public ExceptionsManagerModule(DevSupportManager devSupportManager) { mDevSupportManager = devSupportManager; }
@Override public DevSupportManager getDevSupportManager() { return mDevSupportManager; }
private DevSupportManager getDevSupportManager() { return getReactInstanceManager().getDevSupportManager(); }
public ReactContextBuilder setDevSupportManager(DevSupportManager devSupportManager) { this.devSupportManager = devSupportManager; return this; }
public abstract DevSupportManager getDevSupportManager();