@@ -23,6 +23,7 @@ import {
23
23
import type {
24
24
SamplesTable ,
25
25
RawThread ,
26
+ RawProfileSharedData ,
26
27
RawMarkerTable ,
27
28
IndexIntoStringTable ,
28
29
IndexIntoRawMarkerTable ,
@@ -409,7 +410,8 @@ export class IPCMarkerCorrelations {
409
410
* (or main thread in receiver process if they are not profiled)
410
411
*/
411
412
export function correlateIPCMarkers (
412
- threads : RawThread [ ]
413
+ threads : RawThread [ ] ,
414
+ shared : RawProfileSharedData
413
415
) : IPCMarkerCorrelations {
414
416
// Create a unique ID constructed from the source PID, destination PID,
415
417
// message seqno, and message type. Since the seqno is only unique for each
@@ -474,6 +476,8 @@ export function correlateIPCMarkers(
474
476
}
475
477
}
476
478
479
+ const stringTable = StringTable . withBackingArray ( shared . stringArray ) ;
480
+
477
481
// First, construct a mapping of marker IDs to an array of markers with that
478
482
// ID for faster lookup. We also collect the friendly thread names while we
479
483
// have access to all the threads. It's considerably more difficult to do
@@ -485,7 +489,6 @@ export function correlateIPCMarkers(
485
489
const threadNames : Map < number , string > = new Map ( ) ;
486
490
for ( let threadIndex = 0 ; threadIndex < threads . length ; threadIndex ++ ) {
487
491
const thread = threads [ threadIndex ] ;
488
- const stringTable = StringTable . withBackingArray ( thread . stringArray ) ;
489
492
// Don't bother checking for IPC markers if this thread's string table
490
493
// doesn't have the string "IPC". This lets us avoid looping over all the
491
494
// markers when we don't have to.
@@ -1638,3 +1641,23 @@ export const stringsToMarkerRegExps = (
1638
1641
fieldMap ,
1639
1642
} ;
1640
1643
} ;
1644
+
1645
+ export function computeStringIndexMarkerFieldsByDataType (
1646
+ markerSchemas : MarkerSchema [ ]
1647
+ ) : Map < string , string [ ] > {
1648
+ const stringIndexMarkerFieldsByDataType = new Map ( ) ;
1649
+ stringIndexMarkerFieldsByDataType . set ( 'CompositorScreenshot' , [ 'url' ] ) ;
1650
+ for ( const schema of markerSchemas ) {
1651
+ const { name , data } = schema ;
1652
+ const stringIndexFields = [ ] ;
1653
+ for ( const field of data ) {
1654
+ if ( field . format === 'unique-string' && field . key ) {
1655
+ stringIndexFields . push ( field . key ) ;
1656
+ }
1657
+ }
1658
+ if ( stringIndexFields . length !== 0 ) {
1659
+ stringIndexMarkerFieldsByDataType . set ( name , stringIndexFields ) ;
1660
+ }
1661
+ }
1662
+ return stringIndexMarkerFieldsByDataType ;
1663
+ }
0 commit comments