@@ -223,24 +223,30 @@ class FirefoxThread {
223
223
tid : number ;
224
224
pid : number ;
225
225
226
- stringArray = [ ] ;
227
- strings = StringTable . withBackingArray ( this . stringArray ) ;
226
+ strings : StringTable ;
228
227
229
228
sampleTable : RawSamplesTable = getEmptySamplesTable ( ) ;
230
229
231
- stackTable : FirefoxSampleTable = new FirefoxSampleTable ( this . strings ) ;
232
- frameTable : FirefoxFrameTable = new FirefoxFrameTable ( this . strings ) ;
233
- funcTable : FirefoxFuncTable = new FirefoxFuncTable ( this . strings ) ;
234
- resourceTable : FirefoxResourceTable = new FirefoxResourceTable ( this . strings ) ;
230
+ stackTable : FirefoxSampleTable ;
231
+ frameTable : FirefoxFrameTable ;
232
+ funcTable : FirefoxFuncTable ;
233
+ resourceTable : FirefoxResourceTable ;
235
234
236
235
cpuClockEventId : number = - 1 ;
237
236
238
- constructor ( thread : report . IThread ) {
237
+ constructor ( thread : report . IThread , stringTable : StringTable ) {
239
238
this . tid = thread . threadId ;
240
239
this . pid = thread . processId ;
241
240
242
241
this . isMainThread = thread . threadId === thread . processId ;
243
242
this . name = thread . threadName ?? '' ;
243
+
244
+ this . strings = stringTable ;
245
+
246
+ this . stackTable = new FirefoxSampleTable ( this . strings ) ;
247
+ this . frameTable = new FirefoxFrameTable ( this . strings ) ;
248
+ this . funcTable = new FirefoxFuncTable ( this . strings ) ;
249
+ this . resourceTable = new FirefoxResourceTable ( this . strings ) ;
244
250
}
245
251
246
252
toJson ( ) : RawThread {
@@ -259,7 +265,6 @@ class FirefoxThread {
259
265
markers : getEmptyRawMarkerTable ( ) ,
260
266
stackTable : this . stackTable . toJson ( ) ,
261
267
frameTable : this . frameTable . toJson ( ) ,
262
- stringArray : this . stringArray ,
263
268
funcTable : this . funcTable . toJson ( ) ,
264
269
resourceTable : this . resourceTable . toJson ( ) ,
265
270
nativeSymbols : getEmptyNativeSymbolTable ( ) ,
@@ -358,10 +363,16 @@ class FirefoxProfile {
358
363
sampleCount : number = 0 ;
359
364
lostCount : number = 0 ;
360
365
366
+ stringArray = [ ] ;
367
+ stringTable = StringTable . withBackingArray ( this . stringArray ) ;
368
+
361
369
toJson ( ) : Profile {
362
370
return {
363
371
meta : this . getProfileMeta ( ) ,
364
372
libs : [ ] ,
373
+ shared : {
374
+ stringArray : this . stringArray ,
375
+ } ,
365
376
threads : this . threads . map ( ( thread ) => thread . toJson ( ) ) ,
366
377
} ;
367
378
}
@@ -439,7 +450,7 @@ class FirefoxProfile {
439
450
}
440
451
441
452
addThread ( thread : report . IThread ) {
442
- const firefoxThread = new FirefoxThread ( thread ) ;
453
+ const firefoxThread = new FirefoxThread ( thread , this . stringTable ) ;
443
454
this . threads . push ( firefoxThread ) ;
444
455
this . threadMap . set ( thread . threadId , firefoxThread ) ;
445
456
}
0 commit comments