From e8e7238e9a1144050cced384b1365a0b75c01521 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Sat, 14 May 2016 18:09:08 -0400 Subject: [PATCH] More cosmetic changes. --- .eslintrc.js | 3 ++- src/components/ProfileViewer.js | 20 ++++++++++++++++---- src/profile-data.js | 11 ++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index aa75ade709..c992f3b2da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -77,7 +77,8 @@ module.exports = { "generator-star-spacing": "error", "no-duplicate-imports": "error", "no-var": "error", - "prefer-const": "error" + "prefer-const": "error", + "array-bracket-spacing": "error" }, "settings": { "react": { diff --git a/src/components/ProfileViewer.js b/src/components/ProfileViewer.js index 87dac7aa52..1cb86159da 100644 --- a/src/components/ProfileViewer.js +++ b/src/components/ProfileViewer.js @@ -65,8 +65,14 @@ class ProfileViewer extends Component { _onSelectedFuncStackChange(newSelectedFuncStack) { const { dispatch, viewOptions, profile } = this.props; - const { selectedThread } = viewOptions; - const thread = profile.threads[selectedThread]; + const { selectedThread, jsOnly, invertCallstack } = viewOptions; + let thread = profile.threads[selectedThread]; + if (jsOnly) { + thread = this._filterToJSOnly(thread); + } + if (invertCallstack) { + thread = this._invertCallStack(thread); + } const funcStackInfo = this._getFuncStackInfo(selectedThread, thread); dispatch(Actions.changeSelectedFuncStack(selectedThread, getStackAsFuncArray(newSelectedFuncStack, funcStackInfo.funcStackTable))); @@ -74,8 +80,14 @@ class ProfileViewer extends Component { _onExpandedFuncStacksChange(newExpandedFuncStacks) { const { dispatch, viewOptions, profile } = this.props; - const { selectedThread } = viewOptions; - const thread = profile.threads[selectedThread]; + const { selectedThread, jsOnly, invertCallstack } = viewOptions; + let thread = profile.threads[selectedThread]; + if (jsOnly) { + thread = this._filterToJSOnly(thread); + } + if (invertCallstack) { + thread = this._invertCallStack(thread); + } const funcStackInfo = this._getFuncStackInfo(selectedThread, thread); dispatch(Actions.changeExpandedFuncStacks(selectedThread, newExpandedFuncStacks.map(funcStackIndex => getStackAsFuncArray(funcStackIndex, funcStackInfo.funcStackTable)))); diff --git a/src/profile-data.js b/src/profile-data.js index b3223981ff..159c38542b 100644 --- a/src/profile-data.js +++ b/src/profile-data.js @@ -2,6 +2,7 @@ import { timeCode } from './time-code'; /** * Various helpers for dealing with the profile as a data structure. + * @module profile-data */ export const resourceTypes = { @@ -16,11 +17,11 @@ export const resourceTypes = { /** * Takes the stack table and the frame table, creates a func stack table and * fixes up the funcStack field in the samples data. - * @param {object} stackTable The thread's stackTable. - * @param {object} frameTable The thread's frameTable. - * @param {object} funcTable The thread's funcTable. - * @param {object} samples The thread's samples. - * @return {object} The funcStackTable and the new samples object. + * @param {Object} stackTable The thread's stackTable. + * @param {Object} frameTable The thread's frameTable. + * @param {Object} funcTable The thread's funcTable. + * @param {Object} samples The thread's samples. + * @return {Object} The funcStackTable and the new samples object. */ export function getFuncStackInfo(stackTable, frameTable, funcTable, samples) { return timeCode('getFuncStackInfo', () => {