* @param {boolean} success * @param {!AbortSignal} signal * @param {*=} opt_reason * @return {!Promise|undefined}
(success, signal, opt_reason)
| 911 | * @return {!Promise|undefined} |
| 912 | */ |
| 913 | layoutComplete_(success, signal, opt_reason) { |
| 914 | this.abortController_ = null; |
| 915 | if (signal.aborted) { |
| 916 | // We hit a race condition, where `layoutCallback` -> `unlayoutCallback` |
| 917 | // was called in quick succession. Since the unlayout was called before |
| 918 | // the layout completed, we want to remain in the unlayout state. |
| 919 | const err = dev().createError('layoutComplete race'); |
| 920 | err.associatedElement = this.element; |
| 921 | dev().expectedError(TAG, err); |
| 922 | throw cancellation(); |
| 923 | } |
| 924 | if (this.loadPromiseResolve_) { |
| 925 | this.loadPromiseResolve_(); |
| 926 | this.loadPromiseResolve_ = null; |
| 927 | } |
| 928 | this.layoutPromise_ = null; |
| 929 | this.state_ = success |
| 930 | ? ResourceState_Enum.LAYOUT_COMPLETE |
| 931 | : ResourceState_Enum.LAYOUT_FAILED; |
| 932 | this.lastLayoutError_ = opt_reason; |
| 933 | if (success) { |
| 934 | dev().fine(TAG, 'layout complete:', this.debugid); |
| 935 | } else { |
| 936 | dev().fine(TAG, 'loading failed:', this.debugid, opt_reason); |
| 937 | return Promise.reject(opt_reason); |
| 938 | } |
| 939 | } |
| 940 | |
| 941 | /** |
| 942 | * Returns true if the resource layout has not completed or failed. |
no test coverage detected