@@ -258,8 +258,21 @@ export type FrameTable = {|
258
258
// nativeSymbol, but each has a different func and line.
259
259
inlineDepth : number [ ] ,
260
260
261
+ // The category of the frame. This is used to calculate the category of the stack nodes
262
+ // which use this frame:
263
+ // - If the frame has a null category, the stack node inherits its parent node's category
264
+ // and subcategory. If there is no parent node, we use the "default category" (see ProfileMeta.categories).
265
+ // - If the frame has a non-null category, this category and subcategory is used for the stack node.
261
266
category : ( IndexIntoCategoryList | null ) [ ] ,
267
+
268
+ // The subcategory of a frame. This is used to calculate the subcategory of the stack nodes
269
+ // which use this frame.
270
+ // Must be non-null if the frame's category is non-null.
271
+ // Ignored if the frame's category is null.
272
+ // 0 is always a valid value and refers to the "Other" subcategory (see Category.subcategories).
262
273
subcategory : ( IndexIntoSubcategoryListForCategory | null ) [ ] ,
274
+
275
+ // The frame's function.
263
276
func : IndexIntoFuncTable [ ] ,
264
277
265
278
// The symbol index (referring into this thread's nativeSymbols table) corresponding
@@ -391,9 +404,36 @@ export type Lib = {|
391
404
codeId : string | null , // e.g. "6132B96B70fd000"
392
405
| } ;
393
406
407
+ // The list of available category colors.
408
+ //
409
+ // We don't accept just any CSS color so that the front-end has more freedom about
410
+ // picking colors, for example to ensure contrast or to adjust to light/dark modes.
411
+ export type CategoryColor =
412
+ | 'transparent' // used for "idle" frames / stacks
413
+ | 'purple'
414
+ | 'green'
415
+ | 'orange'
416
+ | 'yellow'
417
+ | 'lightblue'
418
+ | 'blue'
419
+ | 'brown'
420
+ | 'magenta'
421
+ | 'red'
422
+ | 'lightred'
423
+ | 'darkgrey'
424
+ | 'grey' ; // <-- "grey" marks the default category
425
+
426
+ // A category in profile.meta.categories, used for stack frames and call nodes.
394
427
export type Category = { |
428
+ // The category name.
395
429
name : string ,
396
- color : string ,
430
+
431
+ // The category color. Must be picked from the CategoryColor list. At least one
432
+ // category with color "grey" must be present in the category list.
433
+ color : CategoryColor ,
434
+
435
+ // The list of subcategories. Must always have at least one element; subcategory
436
+ // zero must be the "Other" subcategory and is used to refer to the category itself.
397
437
subcategories : string [ ] ,
398
438
| } ;
399
439
@@ -739,10 +779,10 @@ export type ProfileMeta = {|
739
779
// The extensions property landed in Firefox 60, and is only optional because older
740
780
// processed profile versions may not have it. No upgrader was written for this change.
741
781
extensions ?: ExtensionTable ,
742
- // The list of categories as provided by the platform. The categories are present for
743
- // all Firefox profiles, but imported profiles may not include any category support.
744
- // The front-end will provide a default list of categories, but the saved profile
745
- // will not include them .
782
+ // The list of categories used in this profile. If present, it must contain at least the
783
+ // "default category" which is defined as the first category whose color is "grey" - this
784
+ // category usually has the name "Other".
785
+ // If meta.categories is not present, a default list is substituted .
746
786
categories ?: CategoryList ,
747
787
// The name of the product, most likely "Firefox".
748
788
product : 'Firefox' | string ,
0 commit comments