Ejemplo n.º 1
0
 void IMultiTreeHandleable.ReAdd(PromisePassThrough passThrough)
 {
     _passThroughs.Push(passThrough);
 }
Ejemplo n.º 2
0
 partial void IncrementProgress(PromisePassThrough passThrough);
Ejemplo n.º 3
0
                bool IMultiTreeHandleable.Handle(Internal.IValueContainer valueContainer, PromisePassThrough passThrough, int index)
                {
                    Promise owner  = passThrough.Owner;
                    bool    done   = --_waitCount == 0;
                    bool    handle = false;

                    if (_pending)
                    {
                        owner._wasWaitedOn = true;
                        if (owner._state != State.Resolved)
                        {
                            _pending = false;
                            ((Internal.ResolveContainer <T>)_valueOrPrevious).Release();
                            valueContainer.Retain();
                            _valueOrPrevious = valueContainer;
                            handle           = true;
                        }
                        else
                        {
                            _onPromiseResolved.Invoke(valueContainer, (Internal.ResolveContainer <T>)_valueOrPrevious, index);
                            if (done)
                            {
                                _pending = false;
                                handle   = true;
                            }
                            else
                            {
                                IncrementProgress(passThrough);
                            }
                        }
                    }
                    if (done)
                    {
                        while (_passThroughs.IsNotEmpty)
                        {
                            _passThroughs.Pop().Release();
                        }
                        ReleaseInternal();
                    }
                    return(handle);
                }
Ejemplo n.º 4
0
                bool IMultiTreeHandleable.Handle(Internal.IValueContainer valueContainer, PromisePassThrough passThrough, int index)
                {
                    Promise owner = passThrough.Owner;

                    owner._wasWaitedOn = true;
                    bool done   = --_waitCount == 0;
                    bool handle = _valueOrPrevious == null & (owner._state == State.Resolved | done);

                    if (handle)
                    {
                        valueContainer.Retain();
                        _valueOrPrevious = valueContainer;
                    }
                    if (done)
                    {
                        while (_passThroughs.IsNotEmpty)
                        {
                            _passThroughs.Pop().Release();
                        }
                        ReleaseInternal();
                    }
                    return(handle);
                }