Skip to content

Commit 0c58863

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[AI] Tell performance agent when call tree is unselected
Bug: 442392194 Change-Id: Id928360ecbe12c0430c67a1913d6fdcf74acd4fb Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6955435 Auto-Submit: Connor Clark <[email protected]> Reviewed-by: Paul Irish <[email protected]> Commit-Queue: Connor Clark <[email protected]>
1 parent a12b79f commit 0c58863

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

front_end/panels/timeline/TimelineFlameChartView.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,29 +1510,25 @@ export class TimelineFlameChartView extends Common.ObjectWrapper.eventMixin<Even
15101510
// supports (currently, only main thread events), then set the context's
15111511
// "flavor" to be the AI Call Tree of the active event.
15121512
// This is listened to by the AI Assistance panel to update its state.
1513-
// Note that we do not change the Context back to `null` if the user picks
1514-
// an invalid event - we don't want to reset it back as it may be they are
1515-
// clicking around in order to understand something.
15161513
// We also do this in a rAF to not block the UI updating to show the selected event first.
1517-
if (selectionIsEvent(selection) && this.#parsedTrace) {
1518-
requestAnimationFrame(() => {
1519-
if (!this.#parsedTrace) {
1520-
return;
1521-
}
1514+
requestAnimationFrame(() => {
1515+
if (!this.#parsedTrace) {
1516+
return;
1517+
}
15221518

1523-
const callTree = AIAssistance.AICallTree.fromEvent(selection.event, this.#parsedTrace);
1524-
if (callTree) {
1525-
let focus = UI.Context.Context.instance().flavor(AIAssistance.AgentFocus);
1526-
if (focus) {
1527-
focus = focus.withCallTree(callTree);
1528-
} else {
1529-
focus = AIAssistance.AgentFocus.fromCallTree(callTree);
1530-
}
1519+
const callTree =
1520+
selectionIsEvent(selection) ? AIAssistance.AICallTree.fromEvent(selection.event, this.#parsedTrace) : null;
1521+
let focus = UI.Context.Context.instance().flavor(AIAssistance.AgentFocus);
1522+
if (focus) {
1523+
focus = focus.withCallTree(callTree);
1524+
} else if (callTree) {
1525+
focus = AIAssistance.AgentFocus.fromCallTree(callTree);
1526+
} else {
1527+
focus = null;
1528+
}
15311529

1532-
UI.Context.Context.instance().setFlavor(AIAssistance.AgentFocus, focus);
1533-
}
1534-
});
1535-
}
1530+
UI.Context.Context.instance().setFlavor(AIAssistance.AgentFocus, focus);
1531+
});
15361532
}
15371533

15381534
// Only opens the details view of a selection. This is used for Timing Markers. Timing markers replace

0 commit comments

Comments
 (0)