2020-07-23 06:37:37 +00:00
|
|
|
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
class State {
|
2020-11-03 08:01:33 +00:00
|
|
|
_timeSelection = {start: 0, end: Infinity};
|
2020-10-19 10:45:42 +00:00
|
|
|
_map;
|
|
|
|
_ic;
|
|
|
|
_selectedMapLogEntries;
|
|
|
|
_selectedIcLogEntries;
|
2020-10-19 17:00:17 +00:00
|
|
|
_selectedDeoptLogEntries;
|
2020-11-30 10:34:28 +00:00
|
|
|
_selecteCodeLogEntries;
|
2020-10-19 10:45:42 +00:00
|
|
|
_selectedSourcePositions;
|
|
|
|
_nofChunks;
|
|
|
|
_chunks;
|
|
|
|
_icTimeline;
|
|
|
|
_mapTimeline;
|
2020-10-19 16:48:36 +00:00
|
|
|
_deoptTimeline;
|
2020-11-30 10:34:28 +00:00
|
|
|
_codeTimeline;
|
2020-12-03 17:48:45 +00:00
|
|
|
_apiTimeline;
|
2020-10-19 10:45:42 +00:00
|
|
|
_minStartTime = Number.POSITIVE_INFINITY;
|
|
|
|
_maxEndTime = Number.NEGATIVE_INFINITY;
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-08-13 09:14:29 +00:00
|
|
|
get minStartTime() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._minStartTime;
|
2020-08-04 13:51:20 +00:00
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-08-13 09:14:29 +00:00
|
|
|
get maxEndTime() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._maxEndTime;
|
2020-08-04 13:51:20 +00:00
|
|
|
}
|
2020-10-19 16:48:36 +00:00
|
|
|
|
|
|
|
selectTimeRange(start, end) {
|
|
|
|
this.timeSelection.start = start;
|
|
|
|
this.timeSelection.end = end;
|
2020-12-02 08:34:43 +00:00
|
|
|
if (start == 0 && end == Infinity) {
|
|
|
|
this.timelines.forEach(each => each.clearSelection());
|
|
|
|
} else {
|
|
|
|
this.timelines.forEach(each => each.selectTimeRange(start, end));
|
|
|
|
}
|
2020-10-19 16:48:36 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 17:48:45 +00:00
|
|
|
setTimelines(
|
|
|
|
mapTimeline, icTimeline, deoptTimeline, codeTimeline, apiTimeline) {
|
2020-11-30 10:34:28 +00:00
|
|
|
this._mapTimeline = mapTimeline;
|
|
|
|
this._icTimeline = icTimeline;
|
|
|
|
this._deoptTimeline = deoptTimeline;
|
|
|
|
this._codeTimeline = codeTimeline;
|
2020-12-03 17:48:45 +00:00
|
|
|
this._apiTimeline = apiTimeline;
|
2020-11-30 10:34:28 +00:00
|
|
|
for (let timeline of arguments) {
|
2020-11-16 13:19:25 +00:00
|
|
|
if (timeline === undefined) return;
|
|
|
|
this._minStartTime = Math.min(this._minStartTime, timeline.startTime);
|
|
|
|
this._maxEndTime = Math.max(this._maxEndTime, timeline.endTime);
|
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
for (let timeline of arguments) {
|
2020-11-16 13:19:25 +00:00
|
|
|
timeline.startTime = this._minStartTime;
|
|
|
|
timeline.endTime = this._maxEndTime;
|
|
|
|
}
|
2020-08-04 13:51:20 +00:00
|
|
|
}
|
2020-11-16 13:19:25 +00:00
|
|
|
|
2020-08-13 09:14:29 +00:00
|
|
|
get mapTimeline() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._mapTimeline;
|
2020-07-28 12:46:10 +00:00
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-10-19 16:48:36 +00:00
|
|
|
get icTimeline() {
|
|
|
|
return this._icTimeline;
|
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-10-19 16:48:36 +00:00
|
|
|
get deoptTimeline() {
|
|
|
|
return this._deoptTimeline;
|
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
|
|
|
get codeTimeline() {
|
|
|
|
return this._codeTimeline;
|
2020-11-16 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 17:48:45 +00:00
|
|
|
get apiTimeline() {
|
|
|
|
return this._apiTimeline;
|
|
|
|
}
|
|
|
|
|
2020-11-16 13:19:25 +00:00
|
|
|
get timelines() {
|
2020-11-30 10:34:28 +00:00
|
|
|
return [
|
2020-12-03 17:48:45 +00:00
|
|
|
this._mapTimeline, this._icTimeline, this._deoptTimeline,
|
|
|
|
this._codeTimeline, this._apiTimeline
|
2020-11-30 10:34:28 +00:00
|
|
|
];
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-11-16 13:19:25 +00:00
|
|
|
|
2020-08-13 09:14:29 +00:00
|
|
|
set chunks(value) {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) split up between maps and ics, and every timeline track
|
2020-10-19 10:45:42 +00:00
|
|
|
this._chunks = value;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-08-13 09:14:29 +00:00
|
|
|
get chunks() {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) split up between maps and ics, and every timeline track
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._chunks;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-11-30 10:34:28 +00:00
|
|
|
|
2020-07-23 06:37:37 +00:00
|
|
|
get nofChunks() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._nofChunks;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
set nofChunks(count) {
|
2020-10-19 10:45:42 +00:00
|
|
|
this._nofChunks = count;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
get map() {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) rename as selectedMapEvents, array of selected events
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._map;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
set map(value) {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) rename as selectedMapEvents, array of selected events
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-10-19 10:45:42 +00:00
|
|
|
this._map = value;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-07-28 12:46:10 +00:00
|
|
|
get ic() {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) rename selectedICEvents, array of selected events
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._ic;
|
2020-07-28 12:46:10 +00:00
|
|
|
}
|
|
|
|
set ic(value) {
|
2020-11-03 08:01:33 +00:00
|
|
|
// TODO(zcankara) rename selectedIcEvents, array of selected events
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-10-19 10:45:42 +00:00
|
|
|
this._ic = value;
|
2020-07-28 12:46:10 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
get selectedMapLogEntries() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._selectedMapLogEntries;
|
2020-08-13 09:14:29 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
set selectedMapLogEntries(value) {
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-10-19 10:45:42 +00:00
|
|
|
this._selectedMapLogEntries = value;
|
2020-08-13 09:14:29 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
get selectedSourcePositions() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._selectedSourcePositions;
|
2020-08-28 14:41:56 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
set selectedSourcePositions(value) {
|
2020-10-19 10:45:42 +00:00
|
|
|
this._selectedSourcePositions = value;
|
2020-08-28 14:41:56 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
get selectedIcLogEntries() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._selectedIcLogEntries;
|
2020-08-13 09:14:29 +00:00
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
set selectedIcLogEntries(value) {
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-10-19 10:45:42 +00:00
|
|
|
this._selectedIcLogEntries = value;
|
2020-08-13 09:14:29 +00:00
|
|
|
}
|
2020-08-04 08:51:59 +00:00
|
|
|
get timeSelection() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._timeSelection;
|
2020-08-04 08:51:59 +00:00
|
|
|
}
|
2020-07-23 06:37:37 +00:00
|
|
|
get entries() {
|
|
|
|
if (!this.map) return {};
|
|
|
|
return {
|
|
|
|
map: this.map.id, time: this.map.time
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 08:01:33 +00:00
|
|
|
export {State};
|