comparison Implab/AbstractPromise.cs @ 156:97fbbf816844 v2

Promises: SignalXXX methods merged into SignalHandler method. Components: RunnableComponent In progress
author cin
date Mon, 15 Feb 2016 04:22:15 +0300
parents 706fccb85524
children 75103928da09
comparison
equal deleted inserted replaced
155:037df317f126 156:97fbbf816844
69 } 69 }
70 70
71 71
72 #region implemented abstract members of AbstractPromise 72 #region implemented abstract members of AbstractPromise
73 73
74 protected override void SignalSuccess(HandlerDescriptor handler) { 74 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
75 handler.SignalSuccess(); 75 switch (signal) {
76 } 76 case SUCCEEDED_STATE:
77 77 handler.SignalSuccess();
78 protected override void SignalError(HandlerDescriptor handler, Exception error) { 78 break;
79 handler.SignalError(error); 79 case REJECTED_STATE:
80 } 80 handler.SignalError(Error);
81 81 break;
82 protected override void SignalCancelled(HandlerDescriptor handler, Exception reason) { 82 case CANCELLED_STATE:
83 handler.SignalCancel(reason); 83 handler.SignalCancel(CancellationReason);
84 break;
85 default:
86 throw new InvalidOperationException(String.Format("Invalid promise signal: {0}", signal));
87 }
84 } 88 }
85 89
86 protected override Signal GetResolveSignal() { 90 protected override Signal GetResolveSignal() {
87 var signal = new Signal(); 91 var signal = new Signal();
88 On(signal.Set, PromiseEventType.All); 92 On(signal.Set, PromiseEventType.All);