static void _schedulePriorityAsyncCallback(ZoneCallback callback) { var state = _getState(); if (state._nextCallback == null) { _scheduleAsyncCallback(callback); state._lastPriorityCallback = state._lastCallback; return; } _AsyncCallbackEntry entry = new _AsyncCallbackEntry(callback); if (state._lastPriorityCallback == null) { entry.next = state._nextCallback; state._nextCallback = state._lastPriorityCallback = entry; } else { entry.next = state._lastPriorityCallback.next; state._lastPriorityCallback.next = entry; state._lastPriorityCallback = entry; if (entry.next == null) { state._lastCallback = entry; } } }
public ZoneCallback registerCallback(Zone zone, ZoneCallback f) { var implementation = _delegationTarget._registerCallback; _Zone implZone = implementation.zone; RegisterCallbackHandler handler = implementation.function; return(handler(implZone, async_._parentDelegate(implZone), zone, f)); }
public override object run(ZoneCallback f) { if (ReferenceEquals(_current, async_._rootZone)) { return(f()); } return(async_._rootRun(null, null, this, f)); }
public void scheduleMicrotask(Zone zone, ZoneCallback f) { var implementation = _delegationTarget._scheduleMicrotask; _Zone implZone = implementation.zone; ScheduleMicrotaskHandler handler = implementation.function; handler(implZone, async_._parentDelegate(implZone), zone, f); }
public Timer createTimer(Zone zone, TimeSpan duration, ZoneCallback f) { var implementation = _delegationTarget._createTimer; _Zone implZone = implementation.zone; CreateTimerHandler handler = implementation.function; return(handler(implZone, async_._parentDelegate(implZone), zone, duration, f)); }
public override object run(ZoneCallback f) { var implementation = _run; ZoneDelegate parentDelegate = async_._parentDelegate(implementation.zone); RunHandler handler = implementation.function; return(handler(implementation.zone, parentDelegate, this, f)); }
public override ZoneCallback registerCallback(ZoneCallback callback) { var implementation = _registerCallback; ZoneDelegate parentDelegate = async_._parentDelegate(implementation.zone); RegisterCallbackHandler handler = implementation.function; return(handler(implementation.zone, parentDelegate, this, callback)); }
internal static void _scheduleImmediate(ZoneCallback callback) { Isolate.ensureExists(); GCHandle callabackHandle = GCHandle.Alloc(callback); UIMonoState_scheduleMicrotask(_scheduleMicrotask, (IntPtr)callabackHandle); }
public override void scheduleMicrotask(ZoneCallback f) { var implementation = _scheduleMicrotask; ZoneDelegate parentDelegate = async_._parentDelegate(implementation.zone); ScheduleMicrotaskHandler handler = implementation.function; handler(implementation.zone, parentDelegate, this, f); }
public object run(Zone zone, ZoneCallback f) { var implementation = _delegationTarget._run; _Zone implZone = implementation.zone; RunHandler handler = implementation.function; return(handler(implZone, async_._parentDelegate(implZone), zone, f)); }
public override Timer createTimer(TimeSpan duration, ZoneCallback f) { var implementation = _createTimer; ZoneDelegate parentDelegate = async_._parentDelegate(implementation.zone); CreateTimerHandler handler = implementation.function; return(handler(implementation.zone, parentDelegate, this, duration, f)); }
public static Timer create(TimeSpan duration, ZoneCallback callback) { if (Zone.current == Zone.root) { return(Zone.current.createTimer(duration, callback)); } return(Zone.current .createTimer(duration, Zone.current.bindCallbackGuarded(callback))); }
public override object runGuarded(ZoneCallback f) { try { return(run(f)); } catch (Exception e) { handleUncaughtError(e); return(null); } }
public override object runGuarded(ZoneCallback f) { try { if (ReferenceEquals(async_._rootZone, _current)) { return(f()); } return(async_._rootRun(null, null, this, f)); } catch (Exception e) { handleUncaughtError(e); return(null); } }
static void _scheduleAsyncCallback(ZoneCallback callback) { var state = _getState(); _AsyncCallbackEntry newEntry = new _AsyncCallbackEntry(callback); if (state._nextCallback == null) { state._nextCallback = state._lastCallback = newEntry; if (!state._isInCallbackLoop) { _AsyncRun._scheduleImmediate(_startMicrotaskLoop); } } else { state._lastCallback.next = newEntry; state._lastCallback = newEntry; } }
public static void scheduleMicrotask(ZoneCallback callback) { _Zone currentZone = (_Zone)Zone.current; if (ReferenceEquals(_rootZone, currentZone)) { // No need to bind the callback. We know that the root's scheduleMicrotask // will be invoked in the root zone. _rootScheduleMicrotask(null, null, _rootZone, callback); return; } _ZoneFunction <ScheduleMicrotaskHandler> implementation = currentZone._scheduleMicrotask; if (ReferenceEquals(_rootZone, implementation.zone) && _rootZone.inSameErrorZone(currentZone)) { _rootScheduleMicrotask( null, null, currentZone, currentZone.registerCallback(callback)); return; } Zone.current.scheduleMicrotask(Zone.current.bindCallbackGuarded(callback)); }
public override ZoneCallback bindCallbackGuarded(ZoneCallback f) { var registered = registerCallback(f); return(() => runGuarded(registered)); }
public override ZoneCallback bindCallback(ZoneCallback f) { return(() => run(f)); }
public override ZoneCallback bindCallbackGuarded(ZoneCallback f) { return(() => runGuarded(f)); }
public abstract object run(ZoneCallback action);
public override void scheduleMicrotask(ZoneCallback f) { async_._rootScheduleMicrotask(null, null, this, f); }
public abstract Timer createTimer(TimeSpan duration, ZoneCallback callback);
public abstract void scheduleMicrotask(ZoneCallback callback);
public abstract ZoneCallback bindCallbackGuarded(ZoneCallback callback);
public abstract ZoneCallback bindCallback(ZoneCallback callback);
internal _AsyncCallbackEntry(ZoneCallback callback) { this.callback = callback; }
public abstract object runGuarded(ZoneCallback action);
public override ZoneCallback registerCallback(ZoneCallback f) => f;
public abstract ZoneCallback registerCallback(ZoneCallback callback);
public override Timer createTimer(TimeSpan duration, ZoneCallback f) { return(Timer._createTimer(duration, f)); }