* @param step Specified step. * @param skip Skip customer perform call. * @param modBy Sampling window size. * @param modDataCount Sampling count. * @return whether unfinished.
(performArgs?: PerformArgs)
| 137 | * @return whether unfinished. |
| 138 | */ |
| 139 | perform(performArgs?: PerformArgs): boolean { |
| 140 | const upTask = this._upstream; |
| 141 | const skip = performArgs && performArgs.skip; |
| 142 | |
| 143 | // TODO some refactor. |
| 144 | // Pull data. Must pull data each time, because context.data |
| 145 | // may be updated by Series.setData. |
| 146 | if (this._dirty && upTask) { |
| 147 | const context = this.context; |
| 148 | context.data = context.outputData = upTask.context.outputData; |
| 149 | } |
| 150 | |
| 151 | if (this.__pipeline) { |
| 152 | this.__pipeline.currentTask = this; |
| 153 | } |
| 154 | |
| 155 | let planResult; |
| 156 | if (this._plan && !skip) { |
| 157 | planResult = this._plan(this.context); |
| 158 | } |
| 159 | |
| 160 | // Support sharding by mod, which changes the render sequence and makes the rendered graphic |
| 161 | // elements uniformed distributed when progress, especially when moving or zooming. |
| 162 | const lastModBy = normalizeModBy(this._modBy); |
| 163 | const lastModDataCount = this._modDataCount || 0; |
| 164 | const modBy = normalizeModBy(performArgs && performArgs.modBy); |
| 165 | const modDataCount = performArgs && performArgs.modDataCount || 0; |
| 166 | if (lastModBy !== modBy || lastModDataCount !== modDataCount) { |
| 167 | planResult = 'reset'; |
| 168 | } |
| 169 | |
| 170 | function normalizeModBy(val: number) { |
| 171 | !(val >= 1) && (val = 1); // jshint ignore:line |
| 172 | return val; |
| 173 | } |
| 174 | |
| 175 | let forceFirstProgress; |
| 176 | if (this._dirty || planResult === 'reset') { |
| 177 | this._dirty = false; |
| 178 | forceFirstProgress = this._doReset(skip); |
| 179 | } |
| 180 | |
| 181 | this._modBy = modBy; |
| 182 | this._modDataCount = modDataCount; |
| 183 | |
| 184 | const step = performArgs && performArgs.step; |
| 185 | |
| 186 | if (upTask) { |
| 187 | if (__DEV__) { |
| 188 | assert(upTask._outputDueEnd != null); |
| 189 | } |
| 190 | this._dueEnd = upTask._outputDueEnd; |
| 191 | } |
| 192 | // DataTask or overallTask |
| 193 | else { |
| 194 | if (__DEV__) { |
| 195 | assert(!this._progress || this._count); |
| 196 | } |
no test coverage detected