(newState)
| 760 | } |
| 761 | |
| 762 | render(newState) { |
| 763 | let oldState = this.currentState; |
| 764 | if (!newState.file || !CallTreeView.isCallTreeMode(newState.mode)) { |
| 765 | this.element.style.display = "none"; |
| 766 | this.currentState = null; |
| 767 | return; |
| 768 | } |
| 769 | |
| 770 | this.currentState = newState; |
| 771 | if (oldState) { |
| 772 | if (newState.file === oldState.file && |
| 773 | newState.start === oldState.start && |
| 774 | newState.end === oldState.end && |
| 775 | newState.mode === oldState.mode && |
| 776 | newState.callTree.attribution === oldState.callTree.attribution && |
| 777 | newState.callTree.categories === oldState.callTree.categories && |
| 778 | newState.callTree.sort === oldState.callTree.sort) { |
| 779 | // No change => just return. |
| 780 | return; |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | this.element.style.display = "inherit"; |
| 785 | |
| 786 | let mode = this.currentState.mode; |
| 787 | if (!oldState || mode !== oldState.mode) { |
| 788 | // Technically, we should also call this if attribution, categories or |
| 789 | // sort change, but the selection is already highlighted by the combobox |
| 790 | // itself, so we do need to do anything here. |
| 791 | this.fillSelects(newState.mode, newState.callTree); |
| 792 | } |
| 793 | |
| 794 | let ownTimeClass = (mode === "bottom-up") ? "numeric-hidden" : "numeric"; |
| 795 | let ownTimeTh = $(this.treeElement.id + "-own-time-header"); |
| 796 | ownTimeTh.classList = ownTimeClass; |
| 797 | let ownTicksTh = $(this.treeElement.id + "-own-ticks-header"); |
| 798 | ownTicksTh.classList = ownTimeClass; |
| 799 | |
| 800 | // Build the tree. |
| 801 | let stackProcessor; |
| 802 | let filter = filterFromFilterId(this.currentState.callTree.attribution); |
| 803 | if (mode === "top-down") { |
| 804 | if (this.currentState.callTree.categories === "rt-entry") { |
| 805 | stackProcessor = |
| 806 | new RuntimeCallTreeProcessor(); |
| 807 | } else { |
| 808 | stackProcessor = |
| 809 | new PlainCallTreeProcessor(filter, false); |
| 810 | } |
| 811 | } else if (mode === "function-list") { |
| 812 | stackProcessor = new FunctionListTree( |
| 813 | filter, this.currentState.callTree.categories === "code-type"); |
| 814 | |
| 815 | } else { |
| 816 | console.assert(mode === "bottom-up"); |
| 817 | if (this.currentState.callTree.categories === "none") { |
| 818 | stackProcessor = |
| 819 | new PlainCallTreeProcessor(filter, true); |
nothing calls this directly
no test coverage detected