| 270 | } |
| 271 | |
| 272 | private _doReset(skip: boolean): boolean { |
| 273 | this._dueIndex = this._outputDueEnd = this._dueEnd = 0; |
| 274 | this._settedOutputEnd = null; |
| 275 | |
| 276 | let progress: TaskResetCallbackReturn<Ctx>; |
| 277 | let forceFirstProgress: boolean; |
| 278 | |
| 279 | if (!skip && this._reset) { |
| 280 | progress = this._reset(this.context); |
| 281 | if (progress && (progress as any).progress) { |
| 282 | forceFirstProgress = (progress as any).forceFirstProgress; |
| 283 | progress = (progress as any).progress; |
| 284 | } |
| 285 | // To simplify no progress checking, array must has item. |
| 286 | if (isArray(progress) && !progress.length) { |
| 287 | progress = null; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | this._progress = progress as TaskProgressCallback<Ctx>; |
| 292 | this._modBy = this._modDataCount = null; |
| 293 | |
| 294 | const downstream = this._downstream; |
| 295 | downstream && downstream.dirty(); |
| 296 | |
| 297 | return forceFirstProgress; |
| 298 | } |
| 299 | |
| 300 | unfinished(): boolean { |
| 301 | return this._progress && this._dueIndex < this._dueEnd; |