Skip to content

Commit 2690409

Browse files
authored
Use getEmptySourceTable instead of constructing the table manually (#5641)
1 parent d396f27 commit 2690409

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/profile-logic/global-data-collector.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import { StringTable } from '../utils/string-table';
6+
import { getEmptySourceTable } from './data-structures';
7+
68
import type {
79
Lib,
810
LibMapping,
@@ -26,7 +28,7 @@ export class GlobalDataCollector {
2628
_libKeyToLibIndex: Map<string, IndexIntoLibs> = new Map();
2729
_stringArray: string[] = [];
2830
_stringTable: StringTable = StringTable.withBackingArray(this._stringArray);
29-
_sources: SourceTable = { length: 0, uuid: [], filename: [] };
31+
_sources: SourceTable = getEmptySourceTable();
3032
_uuidToSourceIndex: Map<string, IndexIntoSourceTable> = new Map();
3133
_filenameToSourceIndex: Map<IndexIntoStringTable, IndexIntoSourceTable> =
3234
new Map();

src/profile-logic/merge-compare.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
getEmptyRawMarkerTable,
2020
getEmptySamplesTableWithEventDelay,
2121
shallowCloneRawMarkerTable,
22+
getEmptySourceTable,
2223
} from './data-structures';
2324
import {
2425
filterRawThreadSamplesToRange,
@@ -499,7 +500,7 @@ function mergeSources(
499500
sources: SourceTable;
500501
translationMaps: TranslationMapForSources[];
501502
} {
502-
const newSources: SourceTable = { length: 0, uuid: [], filename: [] };
503+
const newSources = getEmptySourceTable();
503504
const mapOfInsertedSources: Map<string, IndexIntoSourceTable> = new Map();
504505

505506
const translationMaps = sourcesPerProfile.map((sources, profileIndex) => {

0 commit comments

Comments
 (0)