Repository navigation
Support filtering CPU profiles by UserTags - #2988
Conversation
|
|
||
| Iterable<String> get userTags => _dataByTag[userTagNone]?.userTags ?? []; | ||
|
|
||
| int selectedProfilerTabIndex = 0; |
There was a problem hiding this comment.
why isn't this a value listenable?
There was a problem hiding this comment.
This isn't a value listenable because nothing needs to be rebuild when this changes. We are already rebuilding when the _tabController has changes. selectedProfilerTabIndex is only accessed by _CpuProfilerState one time in initState, so we don't need to listen to changes to it.
| value: tag, | ||
| ), | ||
| ], | ||
| onChanged: userTags.isNotEmpty ? _onUserTagChanged : null, |
There was a problem hiding this comment.
shouldn't this be items.length > 1 instead of userTags.isNotEmpty?
I expect you don't really want this to be selectable if the only tag was the default tag.
There was a problem hiding this comment.
this is what this code is doing. items above will always have one item because we are showing a none option to negate any filters and show all samples. Then after that item, we will add the items from userTags, so if userTags is empty, items will have length 1 with just the none option. If userTags has length 1, then the two options we'd want to show are the one user tag and the none item.
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
| import 'dart:developer'; |
There was a problem hiding this comment.
for accessing UserTag.defaultTag

If a user specifies UserTags in their code, those tags will show up in the DevTools CPU profiler as filter options.

Fixes #2964
Fixes #947