2020-10-15 20:17:08 +02: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.
|
|
|
|
|
2021-02-11 19:03:35 +01:00
|
|
|
export class LogEntry {
|
2020-10-15 20:17:08 +02:00
|
|
|
constructor(type, time) {
|
2022-09-21 13:28:42 +02:00
|
|
|
/** @type {number} */
|
2021-02-11 19:03:35 +01:00
|
|
|
this._time = time;
|
|
|
|
this._type = type;
|
2022-09-21 13:28:42 +02:00
|
|
|
/** @type {?SourcePosition} */
|
2021-02-24 14:47:06 +01:00
|
|
|
this.sourcePosition = undefined;
|
2020-10-15 20:17:08 +02:00
|
|
|
}
|
2021-02-24 14:47:06 +01:00
|
|
|
|
2020-11-13 12:51:53 +01:00
|
|
|
get time() {
|
2021-02-11 19:03:35 +01:00
|
|
|
return this._time;
|
2020-10-15 20:17:08 +02:00
|
|
|
}
|
2021-02-24 14:47:06 +01:00
|
|
|
|
2020-11-13 12:51:53 +01:00
|
|
|
get type() {
|
2021-02-11 19:03:35 +01:00
|
|
|
return this._type;
|
2020-10-15 20:17:08 +02:00
|
|
|
}
|
2021-02-24 14:47:06 +01:00
|
|
|
|
|
|
|
get script() {
|
|
|
|
return this.sourcePosition?.script;
|
|
|
|
}
|
|
|
|
|
|
|
|
toString() {
|
2021-08-29 14:20:49 +02:00
|
|
|
let name = this.constructor.name;
|
|
|
|
const index = name.lastIndexOf('LogEntry');
|
|
|
|
if (index > 0) {
|
|
|
|
name = name.substr(0, index);
|
|
|
|
}
|
|
|
|
return `${name}(${this._type})`;
|
2021-02-24 14:47:06 +01:00
|
|
|
}
|
|
|
|
|
2021-08-29 14:20:49 +02:00
|
|
|
get toolTipDict() {
|
|
|
|
const toolTipDescription = {
|
|
|
|
__proto__: null,
|
|
|
|
__this__: this,
|
|
|
|
title: this.toString()
|
|
|
|
};
|
|
|
|
for (let key of this.constructor.propertyNames) {
|
|
|
|
toolTipDescription[key] = this[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
return toolTipDescription;
|
2021-02-24 14:47:06 +01:00
|
|
|
}
|
|
|
|
|
2021-02-11 19:03:35 +01:00
|
|
|
// Returns an Array of all possible #type values.
|
2022-09-21 13:28:42 +02:00
|
|
|
/** @return {string[]} */
|
2021-02-11 19:03:35 +01:00
|
|
|
static get allTypes() {
|
|
|
|
throw new Error('Not implemented.');
|
|
|
|
}
|
2021-08-29 14:20:49 +02:00
|
|
|
|
|
|
|
// Returns an array of public property names.
|
2022-09-21 13:28:42 +02:00
|
|
|
/** @return {string[]} */
|
2021-08-29 14:20:49 +02:00
|
|
|
static get propertyNames() {
|
|
|
|
throw new Error('Not implemented.');
|
|
|
|
}
|
2022-09-21 13:28:42 +02:00
|
|
|
}
|