diff --git a/src/__tests__/__snapshots__/profilingCharts-test.js.snap b/src/__tests__/__snapshots__/profilingCharts-test.js.snap
index 9da03f5935..043ac17f80 100644
--- a/src/__tests__/__snapshots__/profilingCharts-test.js.snap
+++ b/src/__tests__/__snapshots__/profilingCharts-test.js.snap
@@ -70,6 +70,10 @@ Object {
3 => 2,
},
"maxSelfDuration": 10,
+ "renderPathNodes": Set {
+ 1,
+ 3,
+ },
"rows": Array [
Array [
Object {
@@ -189,6 +193,9 @@ Object {
3 => 2,
},
"maxSelfDuration": 10,
+ "renderPathNodes": Set {
+ 1,
+ },
"rows": Array [
Array [
Object {
diff --git a/src/devtools/views/Profiler/ChartNode.js b/src/devtools/views/Profiler/ChartNode.js
index b739434e63..121f46ecb2 100644
--- a/src/devtools/views/Profiler/ChartNode.js
+++ b/src/devtools/views/Profiler/ChartNode.js
@@ -13,6 +13,7 @@ type Props = {|
onClick: (event: SyntheticMouseEvent<*>) => mixed,
onDoubleClick?: (event: SyntheticMouseEvent<*>) => mixed,
placeLabelAboveNode?: boolean,
+ textStyle?: Object,
width: number,
x: number,
y: number,
@@ -27,6 +28,7 @@ export default function ChartNode({
label,
onClick,
onDoubleClick,
+ textStyle,
width,
x,
y,
@@ -57,7 +59,9 @@ export default function ChartNode({
}}
y={height < textHeight ? -textHeight : 0}
>
-
{label}
+
+ {label}
+
)}
diff --git a/src/devtools/views/Profiler/CommitFlamegraph.css b/src/devtools/views/Profiler/CommitFlamegraph.css
index bc441e485e..d9ab14ef3c 100644
--- a/src/devtools/views/Profiler/CommitFlamegraph.css
+++ b/src/devtools/views/Profiler/CommitFlamegraph.css
@@ -3,3 +3,8 @@
height: 100%;
padding: 0.5rem;
}
+
+.PatternPath {
+ stroke: var(--color-commit-did-not-render-pattern);
+ stroke-width: 1;
+}
diff --git a/src/devtools/views/Profiler/CommitFlamegraph.js b/src/devtools/views/Profiler/CommitFlamegraph.js
index 881da0e77b..9827224152 100644
--- a/src/devtools/views/Profiler/CommitFlamegraph.js
+++ b/src/devtools/views/Profiler/CommitFlamegraph.js
@@ -1,6 +1,6 @@
// @flow
-import React, { useCallback, useContext, useMemo } from 'react';
+import React, { forwardRef, useCallback, useContext, useMemo } from 'react';
import AutoSizer from 'react-virtualized-auto-sizer';
import { FixedSizeList } from 'react-window';
import { ProfilerContext } from './ProfilerContext';
@@ -152,7 +152,7 @@ function CommitFlamegraph({
return (
);
}
+
+const InnerElementType = forwardRef(({ children, ...rest }, ref) => (
+
+));
diff --git a/src/devtools/views/Profiler/CommitFlamegraphListItem.js b/src/devtools/views/Profiler/CommitFlamegraphListItem.js
index b5829d11e3..d5bc614542 100644
--- a/src/devtools/views/Profiler/CommitFlamegraphListItem.js
+++ b/src/devtools/views/Profiler/CommitFlamegraphListItem.js
@@ -23,7 +23,7 @@ function CommitFlamegraphListItem({ data, index, style }: Props) {
selectFiber,
width,
} = data;
- const { maxSelfDuration, rows } = chartData;
+ const { renderPathNodes, maxSelfDuration, rows } = chartData;
const handleClick = useCallback(
(event: SyntheticMouseEvent<*>, id: number, name: string) => {
@@ -76,9 +76,14 @@ function CommitFlamegraphListItem({ data, index, style }: Props) {
return null;
}
- let color = 'var(--color-commit-did-not-render)';
+ let color = 'url(#didNotRenderPattern)';
+ let textColor = 'var(--color-commit-did-not-render-pattern-text)';
if (didRender) {
color = getGradientColor(selfDuration / maxSelfDuration);
+ textColor = 'var(--color-commit-gradient-text)';
+ } else if (renderPathNodes.has(id)) {
+ color = 'var(--color-commit-did-not-render-fill)';
+ textColor = 'var(--color-commit-did-not-render-fill-text)';
}
return (
@@ -89,6 +94,7 @@ function CommitFlamegraphListItem({ data, index, style }: Props) {
key={id}
label={label}
onClick={event => handleClick(event, id, name)}
+ textStyle={{ color: textColor }}
width={nodeWidth}
x={nodeOffset - selectedNodeOffset}
y={top}
diff --git a/src/devtools/views/Profiler/FlamegraphChartBuilder.js b/src/devtools/views/Profiler/FlamegraphChartBuilder.js
index be52349fb3..994a08c777 100644
--- a/src/devtools/views/Profiler/FlamegraphChartBuilder.js
+++ b/src/devtools/views/Profiler/FlamegraphChartBuilder.js
@@ -21,6 +21,7 @@ export type ChartData = {|
depth: number,
idToDepthMap: Map,
maxSelfDuration: number,
+ renderPathNodes: Set,
rows: Array>,
|};
@@ -44,6 +45,7 @@ export function getChartData({
}
const idToDepthMap: Map = new Map();
+ const renderPathNodes: Set = new Set();
const rows: Array> = [];
let maxDepth = 0;
@@ -129,11 +131,30 @@ export function getChartData({
walkTree(id, baseDuration, 1);
}
+ actualDurations.forEach((duration, id) => {
+ const node = nodes.get(id);
+ if (node != null) {
+ let currentID = node.parentID;
+ while (currentID !== 0) {
+ if (renderPathNodes.has(currentID)) {
+ // We've already walked this path; we can skip it.
+ break;
+ } else {
+ renderPathNodes.add(currentID);
+ }
+
+ const node = nodes.get(currentID);
+ currentID = node != null ? node.parentID : 0;
+ }
+ }
+ });
+
const chartData = {
baseDuration,
depth: maxDepth,
idToDepthMap,
maxSelfDuration,
+ renderPathNodes,
rows,
};
diff --git a/src/devtools/views/Profiler/InteractionListItem.css b/src/devtools/views/Profiler/InteractionListItem.css
index 6d354ca015..62784d3333 100644
--- a/src/devtools/views/Profiler/InteractionListItem.css
+++ b/src/devtools/views/Profiler/InteractionListItem.css
@@ -28,7 +28,8 @@
.InteractionLine {
position: absolute;
height: 3px;
- background-color: var(--color-commit-did-not-render);
+ background-color: var(--color-commit-did-not-render-fill);
+ color: var(--color-commit-did-not-render-fill-text);
border-radius: 0.125rem;
}
@@ -36,6 +37,7 @@
position: absolute;
width: var(--interaction-commit-size);
height: var(--interaction-commit-size);
- background-color: var(--color-commit-did-not-render);
+ background-color: var(--color-commit-did-not-render-fill);
+ color: var(--color-commit-did-not-render-fill-text);
cursor: pointer;
}
diff --git a/src/devtools/views/Profiler/SnapshotCommitListItem.css b/src/devtools/views/Profiler/SnapshotCommitListItem.css
index e017a26c14..dc6592a931 100644
--- a/src/devtools/views/Profiler/SnapshotCommitListItem.css
+++ b/src/devtools/views/Profiler/SnapshotCommitListItem.css
@@ -11,5 +11,6 @@
.Inner {
width: 100%;
min-height: 5px;
- background-color: var(--color-commit-did-not-render);
+ background-color: var(--color-commit-did-not-render-fill);
+ color: var(--color-commit-did-not-render-fill-text);
}
diff --git a/src/devtools/views/Settings/SettingsContext.js b/src/devtools/views/Settings/SettingsContext.js
index 9d6c32dbb3..17194aaa03 100644
--- a/src/devtools/views/Settings/SettingsContext.js
+++ b/src/devtools/views/Settings/SettingsContext.js
@@ -214,7 +214,26 @@ function updateThemeVariables(
updateStyleHelper(theme, 'color-button-disabled', documentElements);
updateStyleHelper(theme, 'color-button-focus', documentElements);
updateStyleHelper(theme, 'color-button-hover', documentElements);
- updateStyleHelper(theme, 'color-commit-did-not-render', documentElements);
+ updateStyleHelper(
+ theme,
+ 'color-commit-did-not-render-fill',
+ documentElements
+ );
+ updateStyleHelper(
+ theme,
+ 'color-commit-did-not-render-fill-text',
+ documentElements
+ );
+ updateStyleHelper(
+ theme,
+ 'color-commit-did-not-render-pattern',
+ documentElements
+ );
+ updateStyleHelper(
+ theme,
+ 'color-commit-did-not-render-pattern-text',
+ documentElements
+ );
updateStyleHelper(theme, 'color-commit-gradient-0', documentElements);
updateStyleHelper(theme, 'color-commit-gradient-1', documentElements);
updateStyleHelper(theme, 'color-commit-gradient-2', documentElements);
diff --git a/src/devtools/views/root.css b/src/devtools/views/root.css
index 16d1387a82..cc6c628106 100644
--- a/src/devtools/views/root.css
+++ b/src/devtools/views/root.css
@@ -19,7 +19,10 @@
--light-color-button-focus: #23272f;
--light-color-button-hover: #23272f;
--light-color-border: #eeeeee;
- --light-color-commit-did-not-render: #cfd1d5;
+ --light-color-commit-did-not-render-fill: #cfd1d5;
+ --light-color-commit-did-not-render-fill-text: #000000;
+ --light-color-commit-did-not-render-pattern: #cfd1d5;
+ --light-color-commit-did-not-render-pattern-text: #000000;
--light-color-commit-gradient-0: #37afa9;
--light-color-commit-gradient-1: #63b19e;
--light-color-commit-gradient-2: #80b393;
@@ -73,7 +76,10 @@
--dark-color-button-focus: #a2e9fc;
--dark-color-button-hover: #ededed;
--dark-color-border: #3d424a;
- --dark-color-commit-did-not-render: #777d88;
+ --dark-color-commit-did-not-render-fill: #777d88;
+ --dark-color-commit-did-not-render-fill-text: #000000;
+ --dark-color-commit-did-not-render-pattern: #666c77;
+ --dark-color-commit-did-not-render-pattern-text: #ffffff;
--dark-color-commit-gradient-0: #37afa9;
--dark-color-commit-gradient-1: #63b19e;
--dark-color-commit-gradient-2: #80b393;