v8/tools/system-analyzer/log/log.mjs
Camillo Bruni a6c474fecc [tools][system-analyzer] Add ToolTip API
Enable more complex tooltips with clickable links and references.

- Use short filename for Script.name if they are unique
- Use shared App.isClickable method
- Remove various toStringLong methods
- Rename CodeLogEntry.disassemble to .code
- Add DOM.button helper

Bug: v8:10644
Change-Id: I5d46ffd560b37278dc46b8347cb9ff0a7fdfa2ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2916373
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74746}
2021-05-25 12:43:52 +00:00

55 lines
1.2 KiB
JavaScript

// 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.
export class LogEntry {
constructor(type, time) {
this._time = time;
this._type = type;
this.sourcePosition = undefined;
}
get time() {
return this._time;
}
get type() {
return this._type;
}
get script() {
return this.sourcePosition?.script;
}
toString() {
let name = this.constructor.name;
const index = name.lastIndexOf('LogEntry');
if (index > 0) {
name = name.substr(0, index);
}
return `${name}(${this._type})`;
}
get toolTipDict() {
const toolTipDescription = {
__proto__: null,
__this__: this,
title: this.toString()
};
for (let key of this.constructor.propertyNames) {
toolTipDescription[key] = this[key];
}
return toolTipDescription;
}
// Returns an Array of all possible #type values.
static get allTypes() {
throw new Error('Not implemented.');
}
// Returns an array of public property names.
static get propertyNames() {
throw new Error('Not implemented.');
}
}