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