mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 12:30:03 +00:00
Revert "[vm, service, observatory] Bang Bang (My Type System Shot Me Down)."
This reverts commit 65e3c9d3b1
.
Reason for revert: package:logging, package:stack_trace and package:usage need to be migrated first.
Original change's description:
> [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
>
> Port the service tests and Observatory to Dart 3.
>
> Changes from the original landing:
>
> - The old tests are copied to observatory_2 / service_2 so the service can still be tested when running a legacy mode program
> - The test harness is taught about 'service_2'
> - Observatory's package is added to front end's opt-in list
> - Fixed some places in the bot configuration matrix so ensure 'service' runs on legacy bots and 'service_2' on weak-mode bots
>
> The ported tests themselves are not changed.
>
> Change-Id: I1d7e5cc61cdc044e1985e851bea7fd8a18f7d810
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149720
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,rmacnak@google.com
Change-Id: I43b72f149d8d7e9fe06006cdd8593fed1726aa3a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152004
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
This commit is contained in:
parent
177511aa17
commit
6bdf55f31f
|
@ -429,23 +429,12 @@
|
|||
"name": "observatory",
|
||||
"rootUri": "../runtime/observatory",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.9"
|
||||
},
|
||||
{
|
||||
"name": "observatory_2",
|
||||
"rootUri": "../runtime/observatory_2",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.2"
|
||||
},
|
||||
{
|
||||
"name": "observatory_test_package",
|
||||
"rootUri": "../runtime/observatory/tests/service/observatory_test_package",
|
||||
"languageVersion": "2.9"
|
||||
},
|
||||
{
|
||||
"name": "observatory_test_package_2",
|
||||
"rootUri": "../runtime/observatory_2/tests/service_2/observatory_test_package_2",
|
||||
"languageVersion": "2.2"
|
||||
"languageVersion": "2.7"
|
||||
},
|
||||
{
|
||||
"name": "package_config",
|
||||
|
|
|
@ -128,12 +128,6 @@ const AllowedExperimentalFlags defaultAllowedExperimentalFlags =
|
|||
"pool": {
|
||||
ExperimentalFlag.nonNullable,
|
||||
},
|
||||
"observatory": {
|
||||
ExperimentalFlag.nonNullable,
|
||||
},
|
||||
"observatory_test_package": {
|
||||
ExperimentalFlag.nonNullable,
|
||||
},
|
||||
"sky_engine": {
|
||||
ExperimentalFlag.nonNullable,
|
||||
},
|
||||
|
|
|
@ -949,7 +949,7 @@ class AnalyzerCompilerConfiguration extends CompilerConfiguration {
|
|||
"ffi_2",
|
||||
"language_2",
|
||||
"lib_2",
|
||||
"service_2",
|
||||
"service",
|
||||
"standalone_2"
|
||||
};
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ const _defaultTestSelectors = [
|
|||
'utils',
|
||||
'lib_2',
|
||||
'analyze_library',
|
||||
'service_2',
|
||||
'service',
|
||||
'kernel',
|
||||
'obseratory_ui_2',
|
||||
'observatory_ui',
|
||||
'ffi_2'
|
||||
];
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ final testSuiteDirectories = [
|
|||
Path('runtime/tests/vm'),
|
||||
Path('runtime/observatory/tests/service'),
|
||||
Path('runtime/observatory/tests/observatory_ui'),
|
||||
Path('runtime/observatory_2/tests/service_2'),
|
||||
Path('samples'),
|
||||
Path('samples-dev'),
|
||||
Path('tests/corelib'),
|
||||
|
|
|
@ -584,7 +584,7 @@ class StandardTestSuite extends TestSuite {
|
|||
_enqueueStandardTest(testFile, expectationSet, onTest);
|
||||
} else if (configuration.runtime.isBrowser) {
|
||||
_enqueueBrowserTest(testFile, expectationSet, onTest);
|
||||
} else if (suiteName == 'service' || suiteName == 'service_2') {
|
||||
} else if (suiteName == 'service') {
|
||||
_enqueueServiceTest(testFile, expectationSet, onTest);
|
||||
} else {
|
||||
_enqueueStandardTest(testFile, expectationSet, onTest);
|
||||
|
|
|
@ -37,8 +37,6 @@ prebuilt_dart2js_action("build_observatory") {
|
|||
"-o",
|
||||
rebase_path(output),
|
||||
"--packages=" + rebase_path("../../.packages"),
|
||||
"--enable-experiment=non-nullable",
|
||||
"--no-sound-null-safety",
|
||||
]
|
||||
if (is_debug) {
|
||||
args += [ "--enable-asserts" ]
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
analyzer:
|
||||
enable-experiment:
|
||||
- non-nullable
|
||||
errors:
|
||||
dead_code: ignore
|
||||
unused_local_variable: ignore
|
||||
getter_not_subtype_setter_types: ignore
|
||||
exclude:
|
||||
- tests/service/bad_reload/v2/main.dart
|
||||
- tests/service/complex_reload/v2/main.dart
|
||||
|
|
|
@ -22,14 +22,14 @@ Future<SnapshotGraph> load(String uri) async {
|
|||
|
||||
reader.onProgress.listen(print);
|
||||
|
||||
ws.listen((dynamic dynResponse) {
|
||||
if (dynResponse is String) {
|
||||
final response = json.decode(dynResponse);
|
||||
ws.listen((dynamic response) {
|
||||
if (response is String) {
|
||||
response = json.decode(response);
|
||||
if (response['id'] == 1) {
|
||||
getVM.complete(response['result']['isolates'][0]['id']);
|
||||
}
|
||||
} else if (dynResponse is List<int>) {
|
||||
final response = new Uint8List.fromList(dynResponse);
|
||||
} else if (response is List<int>) {
|
||||
response = new Uint8List.fromList(response);
|
||||
final dataOffset =
|
||||
new ByteData.view(response.buffer).getUint32(0, Endian.little);
|
||||
dynamic metadata = new Uint8List.view(response.buffer, 4, dataOffset - 4);
|
||||
|
|
|
@ -30,7 +30,7 @@ void repl(VM vm, Isolate isolate, String lastResult) {
|
|||
void main() {
|
||||
String addr = 'ws://localhost:8181/ws';
|
||||
new WebSocketVM(new WebSocketVMTarget(addr)).load().then((serviceObject) {
|
||||
VM vm = serviceObject as VM;
|
||||
VM vm = serviceObject;
|
||||
Isolate isolate = vm.isolates.first;
|
||||
repl(vm, isolate, 'isolate ${isolate.id}');
|
||||
});
|
||||
|
|
|
@ -108,7 +108,7 @@ class PauseBreakpointEvent implements M.PauseBreakpointEvent {
|
|||
final bool atAsyncSuspension;
|
||||
|
||||
/// [optional]
|
||||
final M.Breakpoint? breakpoint;
|
||||
final M.Breakpoint breakpoint;
|
||||
PauseBreakpointEvent(
|
||||
this.timestamp,
|
||||
this.isolate,
|
||||
|
@ -128,7 +128,7 @@ class PauseBreakpointEvent implements M.PauseBreakpointEvent {
|
|||
class PauseInterruptedEvent implements M.PauseInterruptedEvent {
|
||||
final DateTime timestamp;
|
||||
final M.IsolateRef isolate;
|
||||
final M.Frame? topFrame;
|
||||
final M.Frame topFrame;
|
||||
final bool atAsyncSuspension;
|
||||
PauseInterruptedEvent(
|
||||
this.timestamp, this.isolate, this.topFrame, this.atAsyncSuspension) {
|
||||
|
@ -141,7 +141,7 @@ class PauseInterruptedEvent implements M.PauseInterruptedEvent {
|
|||
class PausePostRequestEvent implements M.PausePostRequestEvent {
|
||||
final DateTime timestamp;
|
||||
final M.IsolateRef isolate;
|
||||
final M.Frame? topFrame;
|
||||
final M.Frame topFrame;
|
||||
final bool atAsyncSuspension;
|
||||
PausePostRequestEvent(
|
||||
this.timestamp, this.isolate, this.topFrame, this.atAsyncSuspension) {
|
||||
|
@ -168,7 +168,7 @@ class PauseExceptionEvent implements M.PauseExceptionEvent {
|
|||
class ResumeEvent implements M.ResumeEvent {
|
||||
final DateTime timestamp;
|
||||
final M.IsolateRef isolate;
|
||||
final M.Frame? topFrame;
|
||||
final M.Frame topFrame;
|
||||
ResumeEvent(this.timestamp, this.isolate, this.topFrame) {
|
||||
assert(timestamp != null);
|
||||
assert(isolate != null);
|
||||
|
@ -309,71 +309,69 @@ class ServiceUnregisteredEvent implements M.ServiceUnregisteredEvent {
|
|||
}
|
||||
}
|
||||
|
||||
M.Event? createEventFromServiceEvent(S.ServiceEvent event) {
|
||||
M.Event createEventFromServiceEvent(S.ServiceEvent event) {
|
||||
switch (event.kind) {
|
||||
case S.ServiceEvent.kVMUpdate:
|
||||
return new VMUpdateEvent(event.timestamp!, event.vm);
|
||||
return new VMUpdateEvent(event.timestamp, event.vm);
|
||||
case S.ServiceEvent.kIsolateStart:
|
||||
return new IsolateStartEvent(event.timestamp!, event.isolate!);
|
||||
return new IsolateStartEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kIsolateRunnable:
|
||||
return new IsolateRunnableEvent(event.timestamp!, event.isolate!);
|
||||
return new IsolateRunnableEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kIsolateUpdate:
|
||||
return new IsolateUpdateEvent(event.timestamp!, event.isolate!);
|
||||
return new IsolateUpdateEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kIsolateReload:
|
||||
return new IsolateReloadEvent(
|
||||
event.timestamp!, event.isolate!, event.error!);
|
||||
event.timestamp, event.isolate, event.error);
|
||||
case S.ServiceEvent.kIsolateExit:
|
||||
return new IsolateExitEvent(event.timestamp!, event.isolate!);
|
||||
return new IsolateExitEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kBreakpointAdded:
|
||||
return new BreakpointAddedEvent(
|
||||
event.timestamp!, event.isolate!, event.breakpoint!);
|
||||
event.timestamp, event.isolate, event.breakpoint);
|
||||
case S.ServiceEvent.kBreakpointResolved:
|
||||
return new BreakpointResolvedEvent(
|
||||
event.timestamp!, event.isolate!, event.breakpoint!);
|
||||
event.timestamp, event.isolate, event.breakpoint);
|
||||
case S.ServiceEvent.kBreakpointRemoved:
|
||||
return new BreakpointRemovedEvent(
|
||||
event.timestamp!, event.isolate!, event.breakpoint!);
|
||||
event.timestamp, event.isolate, event.breakpoint);
|
||||
case S.ServiceEvent.kDebuggerSettingsUpdate:
|
||||
return new DebuggerSettingsUpdateEvent(event.timestamp!, event.isolate!);
|
||||
return new DebuggerSettingsUpdateEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kResume:
|
||||
return new ResumeEvent(event.timestamp!, event.isolate!, event.topFrame);
|
||||
return new ResumeEvent(event.timestamp, event.isolate, event.topFrame);
|
||||
case S.ServiceEvent.kPauseStart:
|
||||
return new PauseStartEvent(event.timestamp!, event.isolate!);
|
||||
return new PauseStartEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kPauseExit:
|
||||
return new PauseExitEvent(event.timestamp!, event.isolate!);
|
||||
return new PauseExitEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kPausePostRequest:
|
||||
return new PausePostRequestEvent(event.timestamp!, event.isolate!,
|
||||
event.topFrame, event.atAsyncSuspension!);
|
||||
return new PausePostRequestEvent(event.timestamp, event.isolate,
|
||||
event.topFrame, event.atAsyncSuspension);
|
||||
case S.ServiceEvent.kPauseBreakpoint:
|
||||
return new PauseBreakpointEvent(
|
||||
event.timestamp!,
|
||||
event.isolate!,
|
||||
event.pauseBreakpoints!,
|
||||
event.topFrame!,
|
||||
event.atAsyncSuspension!,
|
||||
event.timestamp,
|
||||
event.isolate,
|
||||
event.pauseBreakpoints,
|
||||
event.topFrame,
|
||||
event.atAsyncSuspension,
|
||||
event.breakpoint);
|
||||
case S.Isolate.kLoggingStream:
|
||||
return new LoggingEvent(
|
||||
event.timestamp!, event.isolate!, event.logRecord!);
|
||||
return new LoggingEvent(event.timestamp, event.isolate, event.logRecord);
|
||||
case S.ServiceEvent.kPauseInterrupted:
|
||||
return new PauseInterruptedEvent(event.timestamp!, event.isolate!,
|
||||
event.topFrame, event.atAsyncSuspension!);
|
||||
return new PauseInterruptedEvent(event.timestamp, event.isolate,
|
||||
event.topFrame, event.atAsyncSuspension);
|
||||
case S.ServiceEvent.kPauseException:
|
||||
return new PauseExceptionEvent(
|
||||
event.timestamp!, event.isolate!, event.topFrame!, event.exception!);
|
||||
event.timestamp, event.isolate, event.topFrame, event.exception);
|
||||
case S.ServiceEvent.kInspect:
|
||||
return new InspectEvent(
|
||||
event.timestamp!, event.isolate!, event.inspectee!);
|
||||
return new InspectEvent(event.timestamp, event.isolate, event.inspectee);
|
||||
case S.ServiceEvent.kGC:
|
||||
return new GCEvent(event.timestamp!, event.isolate!);
|
||||
return new GCEvent(event.timestamp, event.isolate);
|
||||
case S.ServiceEvent.kServiceRegistered:
|
||||
return new ServiceRegisteredEvent(
|
||||
event.timestamp!, event.service!, event.method!, event.alias!);
|
||||
event.timestamp, event.service, event.method, event.alias);
|
||||
case S.ServiceEvent.kServiceUnregistered:
|
||||
return new ServiceUnregisteredEvent(
|
||||
event.timestamp!, event.service!, event.method!);
|
||||
event.timestamp, event.service, event.method);
|
||||
case S.ServiceEvent.kNone:
|
||||
return new NoneEvent(event.timestamp!, event.isolate!);
|
||||
return new NoneEvent(event.timestamp, event.isolate);
|
||||
default:
|
||||
// Ignore unrecognized events.
|
||||
Logger.root.severe('Unrecognized event: $event');
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class SnapshotReader {
|
|||
|
||||
class _SnapshotReader implements SnapshotReader {
|
||||
bool _closed = false;
|
||||
List<Uint8List>? _chunks = <Uint8List>[];
|
||||
var _chunks = <Uint8List>[];
|
||||
final _onProgress = new StreamController<String>.broadcast();
|
||||
final _done = new Completer<SnapshotGraph>();
|
||||
|
||||
|
@ -32,8 +32,8 @@ class _SnapshotReader implements SnapshotReader {
|
|||
if (_closed) {
|
||||
throw new StateError("Stream is closed");
|
||||
}
|
||||
_chunks!.add(chunk);
|
||||
_onProgress.add("Receiving snapshot chunk ${_chunks!.length}...");
|
||||
_chunks.add(chunk);
|
||||
_onProgress.add("Receiving snapshot chunk ${_chunks.length}...");
|
||||
|
||||
// TODO(rmacnak): Incremental loading.
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class _SnapshotReader implements SnapshotReader {
|
|||
_closed = true;
|
||||
|
||||
var graph = new _SnapshotGraph._new();
|
||||
var chunks = _chunks!;
|
||||
var chunks = _chunks;
|
||||
_chunks = null; // Let the binary chunks be GCable.
|
||||
_done.complete(graph._load(chunks, _onProgress));
|
||||
return _done.future;
|
||||
|
@ -270,39 +270,39 @@ class _SnapshotObject implements SnapshotObject {
|
|||
int get hashCode => _id ^ _graph.hashCode;
|
||||
|
||||
int get shallowSize => internalSize + externalSize;
|
||||
int get internalSize => _graph._internalSizes![_id];
|
||||
int get externalSize => _graph._externalSizes![_id];
|
||||
int get retainedSize => _graph._retainedSizes![_id];
|
||||
int get internalSize => _graph._internalSizes[_id];
|
||||
int get externalSize => _graph._externalSizes[_id];
|
||||
int get retainedSize => _graph._retainedSizes[_id];
|
||||
|
||||
String get description => _graph._describeObject(_id);
|
||||
SnapshotClass get klass => _graph._classes![_graph._cids![_id]]!;
|
||||
SnapshotClass get klass => _graph._classes[_graph._cids[_id]];
|
||||
|
||||
Iterable<SnapshotObject> get successors sync* {
|
||||
final id = _id;
|
||||
final cid = _graph._cids![id];
|
||||
final startSuccIndex = _graph._firstSuccs![id];
|
||||
final limitSuccIndex = _graph._firstSuccs![id + 1];
|
||||
final cid = _graph._cids[id];
|
||||
final startSuccIndex = _graph._firstSuccs[id];
|
||||
final limitSuccIndex = _graph._firstSuccs[id + 1];
|
||||
for (var nextSuccIndex = startSuccIndex;
|
||||
nextSuccIndex < limitSuccIndex;
|
||||
nextSuccIndex++) {
|
||||
final index = nextSuccIndex - startSuccIndex;
|
||||
final succId = _graph._succs![nextSuccIndex];
|
||||
final succId = _graph._succs[nextSuccIndex];
|
||||
final name = _graph._edgeName(cid, index);
|
||||
yield _SnapshotObject._new(succId, _graph, name);
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<SnapshotObject> get predecessors sync* {
|
||||
var firstSuccs = _graph._firstSuccs!;
|
||||
var succs = _graph._succs!;
|
||||
var firstSuccs = _graph._firstSuccs;
|
||||
var succs = _graph._succs;
|
||||
var id = _id;
|
||||
var N = _graph._N!;
|
||||
var N = _graph._N;
|
||||
for (var predId = 1; predId <= N; predId++) {
|
||||
var base = firstSuccs[predId];
|
||||
var limit = firstSuccs[predId + 1];
|
||||
for (var i = base; i < limit; i++) {
|
||||
if (succs[i] == id) {
|
||||
var cid = _graph._cids![predId];
|
||||
var cid = _graph._cids[predId];
|
||||
var name = _graph._edgeName(cid, i - base);
|
||||
yield _SnapshotObject._new(predId, _graph, name);
|
||||
}
|
||||
|
@ -314,12 +314,12 @@ class _SnapshotObject implements SnapshotObject {
|
|||
if (_id == _ROOT) {
|
||||
return this;
|
||||
}
|
||||
return _SnapshotObject._new(_graph._doms![_id], _graph, "");
|
||||
return _SnapshotObject._new(_graph._doms[_id], _graph, "");
|
||||
}
|
||||
|
||||
Iterable<SnapshotObject> get children sync* {
|
||||
var N = _graph._N!;
|
||||
var doms = _graph._doms!;
|
||||
var N = _graph._N;
|
||||
var doms = _graph._doms;
|
||||
var parentId = _id;
|
||||
for (var childId = _ROOT; childId <= N; childId++) {
|
||||
if (doms[childId] == parentId) {
|
||||
|
@ -374,7 +374,7 @@ abstract class SnapshotMergedDominator {
|
|||
class _SnapshotMergedDominator implements SnapshotMergedDominator {
|
||||
final int _id;
|
||||
final _SnapshotGraph _graph;
|
||||
final _SnapshotMergedDominator? _parent;
|
||||
final _SnapshotMergedDominator _parent;
|
||||
|
||||
_SnapshotMergedDominator._new(this._id, this._graph, this._parent);
|
||||
|
||||
|
@ -389,78 +389,70 @@ class _SnapshotMergedDominator implements SnapshotMergedDominator {
|
|||
|
||||
String get description => "$instanceCount instances of ${klass.name}";
|
||||
|
||||
SnapshotClass get klass => _graph._classes![_graph._cids![_id]]!;
|
||||
SnapshotClass get klass => _graph._classes[_graph._cids[_id]];
|
||||
|
||||
int get shallowSize => internalSize + externalSize;
|
||||
|
||||
int get internalSize {
|
||||
var cids = _graph._cids!;
|
||||
var internalSizes = _graph._internalSizes!;
|
||||
var mergedDomNext = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids;
|
||||
var size = 0;
|
||||
var sibling = _id;
|
||||
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
|
||||
size += internalSizes[sibling];
|
||||
sibling = mergedDomNext[sibling];
|
||||
size += _graph._internalSizes[sibling];
|
||||
sibling = _graph._mergedDomNext[sibling];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int get externalSize {
|
||||
var cids = _graph._cids!;
|
||||
var externalSizes = _graph._externalSizes!;
|
||||
var mergedDomNext = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids;
|
||||
var size = 0;
|
||||
var sibling = _id;
|
||||
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
|
||||
size += externalSizes[sibling];
|
||||
sibling = mergedDomNext[sibling];
|
||||
size += _graph._externalSizes[sibling];
|
||||
sibling = _graph._mergedDomNext[sibling];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int get retainedSize {
|
||||
var cids = _graph._cids!;
|
||||
var retainedSizes = _graph._retainedSizes!;
|
||||
var mergedDomNext = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids;
|
||||
var size = 0;
|
||||
var sibling = _id;
|
||||
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
|
||||
size += retainedSizes[sibling];
|
||||
sibling = mergedDomNext[sibling];
|
||||
size += _graph._retainedSizes[sibling];
|
||||
sibling = _graph._mergedDomNext[sibling];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int get instanceCount {
|
||||
var cids = _graph._cids!;
|
||||
var mergedDomNext = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids;
|
||||
var count = 0;
|
||||
var sibling = _id;
|
||||
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
|
||||
count++;
|
||||
sibling = mergedDomNext[sibling];
|
||||
sibling = _graph._mergedDomNext[sibling];
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
Iterable<SnapshotObject> get objects sync* {
|
||||
var cids = _graph._cids!;
|
||||
var mergedDomNext = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids;
|
||||
var sibling = _id;
|
||||
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
|
||||
yield _SnapshotObject._new(sibling, _graph, "");
|
||||
sibling = mergedDomNext[sibling];
|
||||
sibling = _graph._mergedDomNext[sibling];
|
||||
}
|
||||
}
|
||||
|
||||
SnapshotMergedDominator get parent => _parent ?? this;
|
||||
|
||||
Iterable<SnapshotMergedDominator> get children sync* {
|
||||
var next = _graph._mergedDomNext!;
|
||||
var cids = _graph._cids!;
|
||||
var next = _graph._mergedDomNext;
|
||||
var cids = _graph._cids;
|
||||
var prev = _SENTINEL;
|
||||
var child = _graph._mergedDomHead![_id];
|
||||
var child = _graph._mergedDomHead[_id];
|
||||
// Walk the list of children and look for the representative objects, i.e.
|
||||
// the first sibling of each cid.
|
||||
while (child != _SENTINEL) {
|
||||
|
@ -512,11 +504,9 @@ class _SnapshotClass implements SnapshotClass {
|
|||
int get instanceCount => liveInstanceCount;
|
||||
|
||||
Iterable<SnapshotObject> get instances sync* {
|
||||
final N = _graph._N!;
|
||||
final cids = _graph._cids!;
|
||||
final retainedSizes = _graph._retainedSizes!;
|
||||
final N = _graph._N;
|
||||
for (var id = 1; id <= N; id++) {
|
||||
if (cids[id] == _cid && retainedSizes[id] > 0) {
|
||||
if (_graph._cids[id] == _cid && _graph._retainedSizes[id] > 0) {
|
||||
yield _SnapshotObject._new(id, _graph, "");
|
||||
}
|
||||
}
|
||||
|
@ -566,27 +556,26 @@ const _kRootName = "Root";
|
|||
const _kUnknownFieldName = "<unknown>";
|
||||
|
||||
class _SnapshotGraph implements SnapshotGraph {
|
||||
List<Uint8List>? _chunks;
|
||||
List<Uint8List> get chunks => _chunks!;
|
||||
List<Uint8List> _chunks;
|
||||
List<Uint8List> get chunks => _chunks;
|
||||
|
||||
_SnapshotGraph._new();
|
||||
|
||||
String get description => _description!;
|
||||
String get description => _description;
|
||||
|
||||
int get size => _liveInternalSize! + _liveExternalSize!;
|
||||
int get internalSize => _liveInternalSize!;
|
||||
int get externalSize => _liveExternalSize!;
|
||||
int get capacity => _capacity!;
|
||||
int get size => _liveInternalSize + _liveExternalSize;
|
||||
int get internalSize => _liveInternalSize;
|
||||
int get externalSize => _liveExternalSize;
|
||||
int get capacity => _capacity;
|
||||
|
||||
SnapshotObject get root => _SnapshotObject._new(_ROOT, this, "Root");
|
||||
SnapshotMergedDominator get mergedRoot =>
|
||||
_SnapshotMergedDominator._new(_ROOT, this, null);
|
||||
|
||||
Iterable<SnapshotObject> get objects sync* {
|
||||
final N = _N!;
|
||||
final retainedSizes = _retainedSizes!;
|
||||
final N = _N;
|
||||
for (var id = 1; id <= N; id++) {
|
||||
if (retainedSizes[id] > 0) {
|
||||
if (_retainedSizes[id] > 0) {
|
||||
yield _SnapshotObject._new(id, this, "");
|
||||
}
|
||||
}
|
||||
|
@ -600,7 +589,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
return _kRootName;
|
||||
}
|
||||
var cls = _className(oid);
|
||||
var data = _nonReferenceData![oid];
|
||||
var data = _nonReferenceData[oid];
|
||||
if (data == null) {
|
||||
return cls;
|
||||
} else {
|
||||
|
@ -609,8 +598,8 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
String _className(int oid) {
|
||||
var cid = _cids![oid];
|
||||
var cls = _classes![cid];
|
||||
var cid = _cids[oid];
|
||||
var cls = _classes[cid];
|
||||
if (cls == null) {
|
||||
return "Class$cid";
|
||||
}
|
||||
|
@ -618,7 +607,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
String _edgeName(int cid, int index) {
|
||||
var c = _classes![cid];
|
||||
var c = _classes[cid];
|
||||
if (c == null) {
|
||||
return _kUnknownFieldName;
|
||||
}
|
||||
|
@ -630,7 +619,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
Iterable<SnapshotClass> get classes sync* {
|
||||
for (final c in _classes!) {
|
||||
for (final c in _classes) {
|
||||
// Not all CIDs are occupied.
|
||||
if (c != null) {
|
||||
yield c;
|
||||
|
@ -641,9 +630,9 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
final processPartitions = new Map<String, int>();
|
||||
|
||||
Future<SnapshotGraph> _load(
|
||||
List<Uint8List>? chunks, StreamController<String> onProgress) async {
|
||||
List<Uint8List> chunks, StreamController<String> onProgress) async {
|
||||
_chunks = chunks;
|
||||
_ReadStream? stream = _ReadStream._new(chunks!);
|
||||
var stream = _ReadStream._new(chunks);
|
||||
chunks = null;
|
||||
|
||||
// The phases of loading are placed in explicit `new Future(compuation)` so
|
||||
|
@ -651,16 +640,16 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
// defer to the microtask loop.
|
||||
|
||||
onProgress.add("Loading classes...");
|
||||
await new Future(() => _readClasses(stream!));
|
||||
await new Future(() => _readClasses(stream));
|
||||
|
||||
onProgress.add("Loading objects...");
|
||||
await new Future(() => _readObjects(stream!));
|
||||
await new Future(() => _readObjects(stream));
|
||||
|
||||
onProgress.add("Loading external properties...");
|
||||
await new Future(() => _readExternalProperties(stream!));
|
||||
await new Future(() => _readExternalProperties(stream));
|
||||
|
||||
onProgress.add("Loading process partitions...");
|
||||
await new Future(() => _readProcessPartitions(stream!));
|
||||
await new Future(() => _readProcessPartitions(stream));
|
||||
stream = null;
|
||||
|
||||
onProgress.add("Compute class table...");
|
||||
|
@ -706,46 +695,46 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
return this;
|
||||
}
|
||||
|
||||
Uint8List? _encoded;
|
||||
Uint8List _encoded;
|
||||
|
||||
String? _description;
|
||||
String _description;
|
||||
|
||||
int? _kStackCid;
|
||||
int? _kFieldCid;
|
||||
int? _numCids;
|
||||
int? _N; // Objects in the snapshot.
|
||||
int? _Nconnected; // Objects reachable from root.
|
||||
int? _E; // References in the snapshot.
|
||||
int _kStackCid;
|
||||
int _kFieldCid;
|
||||
int _numCids;
|
||||
int _N; // Objects in the snapshot.
|
||||
int _Nconnected; // Objects reachable from root.
|
||||
int _E; // References in the snapshot.
|
||||
|
||||
int? _capacity;
|
||||
int? _liveInternalSize;
|
||||
int? _liveExternalSize;
|
||||
int? _totalInternalSize;
|
||||
int? _totalExternalSize;
|
||||
int _capacity;
|
||||
int _liveInternalSize;
|
||||
int _liveExternalSize;
|
||||
int _totalInternalSize;
|
||||
int _totalExternalSize;
|
||||
|
||||
List<_SnapshotClass?>? _classes;
|
||||
List<_SnapshotClass> _classes;
|
||||
|
||||
// Indexed by node id, with id 0 representing invalid/uninitialized.
|
||||
// From snapshot.
|
||||
List? _nonReferenceData;
|
||||
Uint16List? _cids;
|
||||
Uint32List? _internalSizes;
|
||||
Uint32List? _externalSizes;
|
||||
Uint32List? _firstSuccs;
|
||||
Uint32List? _succs;
|
||||
List _nonReferenceData;
|
||||
Uint16List _cids;
|
||||
Uint32List _internalSizes;
|
||||
Uint32List _externalSizes;
|
||||
Uint32List _firstSuccs;
|
||||
Uint32List _succs;
|
||||
|
||||
// Intermediates.
|
||||
Uint32List? _vertex;
|
||||
Uint32List? _parent;
|
||||
Uint32List? _semi;
|
||||
Uint32List? _firstPreds; // Offset into preds.
|
||||
Uint32List? _preds;
|
||||
Uint32List _vertex;
|
||||
Uint32List _parent;
|
||||
Uint32List _semi;
|
||||
Uint32List _firstPreds; // Offset into preds.
|
||||
Uint32List _preds;
|
||||
|
||||
// Outputs.
|
||||
Uint32List? _doms;
|
||||
Uint32List? _retainedSizes;
|
||||
Uint32List? _mergedDomHead;
|
||||
Uint32List? _mergedDomNext;
|
||||
Uint32List _doms;
|
||||
Uint32List _retainedSizes;
|
||||
Uint32List _mergedDomHead;
|
||||
Uint32List _mergedDomNext;
|
||||
|
||||
void _readClasses(_ReadStream stream) {
|
||||
for (var i = 0; i < 8; i++) {
|
||||
|
@ -759,7 +748,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
_totalExternalSize = stream.readUnsigned();
|
||||
|
||||
var K = stream.readUnsigned();
|
||||
var classes = new List<_SnapshotClass?>.filled(K + 1, null);
|
||||
var classes = new List<_SnapshotClass>.filled(K + 1, null);
|
||||
classes[0] = _SnapshotClass._new(this, 0, "Root", "", "");
|
||||
|
||||
for (var cid = 1; cid <= K; cid++) {
|
||||
|
@ -802,7 +791,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
|
||||
var internalSizes = _newUint32Array(N + 1);
|
||||
var cids = _newUint16Array(N + 1);
|
||||
var nonReferenceData = new List<dynamic>.filled(N + 1, null);
|
||||
var nonReferenceData = new List(N + 1);
|
||||
var firstSuccs = _newUint32Array(N + 2);
|
||||
var succs = _newUint32Array(E);
|
||||
var eid = 0;
|
||||
|
@ -878,7 +867,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _readExternalProperties(_ReadStream stream) {
|
||||
final N = _N!;
|
||||
final N = _N;
|
||||
final externalPropertyCount = stream.readUnsigned();
|
||||
|
||||
final externalSizes = _newUint32Array(N + 1);
|
||||
|
@ -904,11 +893,11 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _computeClassTable() {
|
||||
final N = _N!;
|
||||
final classes = _classes!;
|
||||
final cids = _cids!;
|
||||
final internalSizes = _internalSizes!;
|
||||
final externalSizes = _externalSizes!;
|
||||
final N = _N;
|
||||
final classes = _classes;
|
||||
final cids = _cids;
|
||||
final internalSizes = _internalSizes;
|
||||
final externalSizes = _externalSizes;
|
||||
var totalInternalSize = 0;
|
||||
var totalExternalSize = 0;
|
||||
|
||||
|
@ -919,7 +908,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
var externalSize = externalSizes[oid];
|
||||
totalExternalSize += externalSize;
|
||||
|
||||
var cls = classes[cids[oid]]!;
|
||||
var cls = classes[cids[oid]];
|
||||
cls.totalInternalSize += internalSize;
|
||||
cls.totalExternalSize += externalSize;
|
||||
cls.totalInstanceCount++;
|
||||
|
@ -930,9 +919,9 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _dfs() {
|
||||
final N = _N!;
|
||||
final firstSuccs = _firstSuccs!;
|
||||
final succs = _succs!;
|
||||
final N = _N;
|
||||
final firstSuccs = _firstSuccs;
|
||||
final succs = _succs;
|
||||
|
||||
final stackNodes = _newUint32Array(N);
|
||||
final stackCurrentEdgePos = _newUint32Array(N);
|
||||
|
@ -1020,11 +1009,11 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _buildPredecessors() {
|
||||
final N = _N!;
|
||||
final Nconnected = _Nconnected!;
|
||||
final E = _E!;
|
||||
final firstSuccs = _firstSuccs!;
|
||||
final succs = _succs!;
|
||||
final N = _N;
|
||||
final Nconnected = _Nconnected;
|
||||
final E = _E;
|
||||
final firstSuccs = _firstSuccs;
|
||||
final succs = _succs;
|
||||
|
||||
// This is first filled with the predecessor counts, then reused to hold the
|
||||
// offset to the first predecessor (see alias below).
|
||||
|
@ -1079,17 +1068,17 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
// Fold the size of any object with in-degree(1) into its parent.
|
||||
// Requires the DFS numbering and predecessor lists.
|
||||
void _buildOwnedSizes() {
|
||||
final N = _N!;
|
||||
final Nconnected = _Nconnected!;
|
||||
final N = _N;
|
||||
final Nconnected = _Nconnected;
|
||||
final kStackCid = _kStackCid;
|
||||
final kFieldCid = _kFieldCid;
|
||||
|
||||
final cids = _cids!;
|
||||
final internalSizes = _internalSizes!;
|
||||
final externalSizes = _externalSizes!;
|
||||
final vertex = _vertex!;
|
||||
final firstPreds = _firstPreds!;
|
||||
final preds = _preds!;
|
||||
final cids = _cids;
|
||||
final internalSizes = _internalSizes;
|
||||
final externalSizes = _externalSizes;
|
||||
final vertex = _vertex;
|
||||
final firstPreds = _firstPreds;
|
||||
final preds = _preds;
|
||||
|
||||
final ownedSizes = _newUint32Array(N + 1);
|
||||
for (var i = 1; i <= Nconnected; i++) {
|
||||
|
@ -1134,11 +1123,11 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
|
||||
// TODO(rmacnak): Maybe keep the per-objects sizes to be able to provide
|
||||
// examples of large owners for each class.
|
||||
final classes = _classes!;
|
||||
final classes = _classes;
|
||||
for (var i = 1; i <= Nconnected; i++) {
|
||||
final v = vertex[i];
|
||||
final cid = cids[v];
|
||||
final cls = classes[cid]!;
|
||||
final cls = classes[cid];
|
||||
cls.ownedSize += ownedSizes[v];
|
||||
}
|
||||
}
|
||||
|
@ -1220,14 +1209,14 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
// T. Lengauer and R. E. Tarjan. "A Fast Algorithm for Finding Dominators
|
||||
// in a Flowgraph."
|
||||
void _buildDominators() {
|
||||
final N = _N!;
|
||||
final Nconnected = _Nconnected!;
|
||||
final N = _N;
|
||||
final Nconnected = _Nconnected;
|
||||
|
||||
final vertex = _vertex!;
|
||||
final semi = _semi!;
|
||||
final parent = _parent!;
|
||||
final firstPreds = _firstPreds!;
|
||||
final preds = _preds!;
|
||||
final vertex = _vertex;
|
||||
final semi = _semi;
|
||||
final parent = _parent;
|
||||
final firstPreds = _firstPreds;
|
||||
final preds = _preds;
|
||||
|
||||
final dom = _newUint32Array(N + 1);
|
||||
|
||||
|
@ -1236,7 +1225,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
for (var i = 1; i <= N; i++) {
|
||||
label[i] = i;
|
||||
}
|
||||
final buckets = new List<dynamic>.filled(N + 1, null);
|
||||
final buckets = new List(N + 1);
|
||||
final child = _newUint32Array(N + 1);
|
||||
final size = _newUint32Array(N + 1);
|
||||
for (var i = 1; i <= N; i++) {
|
||||
|
@ -1263,7 +1252,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
// w.semi.bucket.add(w);
|
||||
var tmp = vertex[semi[w]];
|
||||
if (buckets[tmp] == null) {
|
||||
buckets[tmp] = [];
|
||||
buckets[tmp] = new List();
|
||||
}
|
||||
buckets[tmp].add(w);
|
||||
|
||||
|
@ -1295,17 +1284,17 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _calculateRetainedSizes() {
|
||||
final N = _N!;
|
||||
final Nconnected = _Nconnected!;
|
||||
final N = _N;
|
||||
final Nconnected = _Nconnected;
|
||||
|
||||
var liveInternalSize = 0;
|
||||
var liveExternalSize = 0;
|
||||
final classes = _classes!;
|
||||
final cids = _cids!;
|
||||
final internalSizes = _internalSizes!;
|
||||
final externalSizes = _externalSizes!;
|
||||
final vertex = _vertex!;
|
||||
final doms = _doms!;
|
||||
final classes = _classes;
|
||||
final cids = _cids;
|
||||
final internalSizes = _internalSizes;
|
||||
final externalSizes = _externalSizes;
|
||||
final vertex = _vertex;
|
||||
final doms = _doms;
|
||||
|
||||
// Sum internal and external sizes.
|
||||
for (var i = 1; i <= Nconnected; i++) {
|
||||
|
@ -1315,7 +1304,7 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
liveInternalSize += internalSize;
|
||||
liveExternalSize += externalSize;
|
||||
|
||||
var cls = classes[cids[v]]!;
|
||||
var cls = classes[cids[v]];
|
||||
cls.liveInternalSize += internalSize;
|
||||
cls.liveExternalSize += externalSize;
|
||||
cls.liveInstanceCount++;
|
||||
|
@ -1346,18 +1335,18 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
_liveInternalSize = liveInternalSize;
|
||||
_liveExternalSize = liveExternalSize;
|
||||
|
||||
print("internal-garbage: ${_totalInternalSize! - _liveInternalSize!}");
|
||||
print("external-garbage: ${_totalExternalSize! - _liveExternalSize!}");
|
||||
print("fragmentation: ${_capacity! - _totalInternalSize!}");
|
||||
assert(_liveInternalSize! <= _totalInternalSize!);
|
||||
assert(_liveExternalSize! <= _totalExternalSize!);
|
||||
assert(_totalInternalSize! <= _capacity!);
|
||||
print("internal-garbage: ${_totalInternalSize - _liveInternalSize}");
|
||||
print("external-garbage: ${_totalExternalSize - _liveExternalSize}");
|
||||
print("fragmentation: ${_capacity - _totalInternalSize}");
|
||||
assert(_liveInternalSize <= _totalInternalSize);
|
||||
assert(_liveExternalSize <= _totalExternalSize);
|
||||
assert(_totalInternalSize <= _capacity);
|
||||
}
|
||||
|
||||
// Build linked lists of the children for each node in the dominator tree.
|
||||
void _linkDominatorChildren() {
|
||||
final N = _N!;
|
||||
final doms = _doms!;
|
||||
final N = _N;
|
||||
final doms = _doms;
|
||||
final head = _newUint32Array(N + 1);
|
||||
final next = _newUint32Array(N + 1);
|
||||
|
||||
|
@ -1411,10 +1400,10 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _sortDominatorChildren() {
|
||||
final N = _N!;
|
||||
final cids = _cids!;
|
||||
final head = _mergedDomHead!;
|
||||
final next = _mergedDomNext!;
|
||||
final N = _N;
|
||||
final cids = _cids;
|
||||
final head = _mergedDomHead;
|
||||
final next = _mergedDomNext;
|
||||
|
||||
// Returns the new head of the sorted list.
|
||||
int sort(int head) {
|
||||
|
@ -1448,10 +1437,10 @@ class _SnapshotGraph implements SnapshotGraph {
|
|||
}
|
||||
|
||||
void _mergeDominatorSiblings() {
|
||||
var N = _N!;
|
||||
var cids = _cids!;
|
||||
var head = _mergedDomHead!;
|
||||
var next = _mergedDomNext!;
|
||||
var N = _N;
|
||||
var cids = _cids;
|
||||
var head = _mergedDomHead;
|
||||
var next = _mergedDomNext;
|
||||
var workStack = _newUint32Array(N);
|
||||
var workStackTop = 0;
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ class WebSocketVMTarget implements M.Target {
|
|||
bool get standalone => !chrome;
|
||||
|
||||
// User defined name.
|
||||
late String name;
|
||||
String name;
|
||||
// Network address of VM.
|
||||
late String networkAddress;
|
||||
String networkAddress;
|
||||
|
||||
WebSocketVMTarget(this.networkAddress) {
|
||||
name = networkAddress;
|
||||
|
@ -89,7 +89,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
|
||||
String get displayName => '${name}@${target.name}';
|
||||
|
||||
CommonWebSocket? _webSocket;
|
||||
CommonWebSocket _webSocket;
|
||||
|
||||
CommonWebSocketVM(this.target, this._webSocket) {
|
||||
assert(target != null);
|
||||
|
@ -120,7 +120,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
void disconnect({String reason: 'WebSocket closed'}) {
|
||||
if (_hasInitiatedConnect) {
|
||||
if (_webSocket != null) {
|
||||
_webSocket!.close();
|
||||
_webSocket.close();
|
||||
}
|
||||
}
|
||||
// We don't need to cancel requests and notify here. These
|
||||
|
@ -135,7 +135,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
if (!_hasInitiatedConnect) {
|
||||
_hasInitiatedConnect = true;
|
||||
try {
|
||||
_webSocket!.connect(
|
||||
_webSocket.connect(
|
||||
target.networkAddress, _onOpen, _onMessage, _onError, _onClose);
|
||||
} catch (_, stack) {
|
||||
_webSocket = null;
|
||||
|
@ -150,7 +150,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
}
|
||||
String serial = (_requestSerial++).toString();
|
||||
var request = new _WebSocketRequest(method, params);
|
||||
if ((_webSocket != null) && _webSocket!.isOpen) {
|
||||
if ((_webSocket != null) && _webSocket.isOpen) {
|
||||
// Already connected, send request immediately.
|
||||
_sendRequest(serial, request);
|
||||
} else {
|
||||
|
@ -180,7 +180,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
_notifyConnect();
|
||||
}
|
||||
|
||||
Map? _parseJSON(String message) {
|
||||
Map _parseJSON(String message) {
|
||||
var map;
|
||||
try {
|
||||
map = json.decode(message);
|
||||
|
@ -198,7 +198,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
}
|
||||
|
||||
void _onBinaryMessage(dynamic data) {
|
||||
_webSocket!.nonStringToByteData(data).then((ByteData bytes) {
|
||||
_webSocket.nonStringToByteData(data).then((ByteData bytes) {
|
||||
var metadataOffset = 4;
|
||||
var dataOffset = bytes.getUint32(0, Endian.little);
|
||||
var metadataLength = dataOffset - metadataOffset;
|
||||
|
@ -292,7 +292,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
|
||||
/// Send all delayed requests.
|
||||
void _sendAllDelayedRequests() {
|
||||
assert(_webSocket!.isOpen);
|
||||
assert(_webSocket.isOpen);
|
||||
if (_delayedRequests.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
|
||||
/// Send the request over WebSocket.
|
||||
void _sendRequest(String serial, _WebSocketRequest request) {
|
||||
assert(_webSocket!.isOpen);
|
||||
assert(_webSocket.isOpen);
|
||||
// Mark request as pending.
|
||||
assert(_pendingRequests.containsKey(serial) == false);
|
||||
_pendingRequests[serial] = request;
|
||||
|
@ -332,7 +332,7 @@ abstract class CommonWebSocketVM extends VM {
|
|||
'GET [${serial}] ${request.method}(${request.params}) from ${target.networkAddress}');
|
||||
}
|
||||
// Send message.
|
||||
_webSocket!.send(message);
|
||||
_webSocket.send(message);
|
||||
}
|
||||
|
||||
String toString() => displayName;
|
||||
|
|
|
@ -14,26 +14,25 @@ import 'package:observatory/service_common.dart';
|
|||
export 'package:observatory/service_common.dart';
|
||||
|
||||
class _HtmlWebSocket implements CommonWebSocket {
|
||||
WebSocket? _webSocket;
|
||||
WebSocket _webSocket;
|
||||
|
||||
void connect(String address, void onOpen(), void onMessage(dynamic data),
|
||||
void onError(), void onClose()) {
|
||||
var socket = new WebSocket(address);
|
||||
socket.onClose.listen((CloseEvent) => onClose());
|
||||
socket.onError.listen((Event) => onError());
|
||||
socket.onOpen.listen((Event) => onOpen());
|
||||
socket.onMessage.listen((MessageEvent event) => onMessage(event.data));
|
||||
_webSocket = socket;
|
||||
_webSocket = new WebSocket(address);
|
||||
_webSocket.onClose.listen((CloseEvent) => onClose());
|
||||
_webSocket.onError.listen((Event) => onError());
|
||||
_webSocket.onOpen.listen((Event) => onOpen());
|
||||
_webSocket.onMessage.listen((MessageEvent event) => onMessage(event.data));
|
||||
}
|
||||
|
||||
bool get isOpen => _webSocket!.readyState == WebSocket.OPEN;
|
||||
bool get isOpen => _webSocket.readyState == WebSocket.OPEN;
|
||||
|
||||
void send(dynamic data) {
|
||||
_webSocket!.send(data);
|
||||
_webSocket.send(data);
|
||||
}
|
||||
|
||||
void close() {
|
||||
_webSocket!.close();
|
||||
_webSocket.close();
|
||||
}
|
||||
|
||||
Future<ByteData> nonStringToByteData(dynamic data) {
|
||||
|
|
|
@ -15,13 +15,13 @@ import 'package:observatory/service_common.dart';
|
|||
export 'package:observatory/service_common.dart';
|
||||
|
||||
class _IOWebSocket implements CommonWebSocket {
|
||||
WebSocket? _webSocket;
|
||||
WebSocket _webSocket;
|
||||
|
||||
void connect(String address, void onOpen(), void onMessage(dynamic data),
|
||||
void onError(), void onClose()) {
|
||||
WebSocket.connect(address).then((WebSocket socket) {
|
||||
_webSocket = socket;
|
||||
socket.listen(onMessage,
|
||||
_webSocket.listen(onMessage,
|
||||
onError: (dynamic) => onError(),
|
||||
onDone: onClose,
|
||||
cancelOnError: true);
|
||||
|
@ -32,14 +32,16 @@ class _IOWebSocket implements CommonWebSocket {
|
|||
}
|
||||
|
||||
bool get isOpen =>
|
||||
(_webSocket != null) && (_webSocket!.readyState == WebSocket.open);
|
||||
(_webSocket != null) && (_webSocket.readyState == WebSocket.open);
|
||||
|
||||
void send(dynamic data) {
|
||||
_webSocket!.add(data);
|
||||
_webSocket.add(data);
|
||||
}
|
||||
|
||||
void close() {
|
||||
_webSocket?.close();
|
||||
if (_webSocket != null) {
|
||||
_webSocket.close();
|
||||
}
|
||||
}
|
||||
|
||||
Future<ByteData> nonStringToByteData(dynamic data) {
|
||||
|
|
|
@ -6,16 +6,15 @@ part of allocation_profiler;
|
|||
|
||||
class AllocationProfile implements M.AllocationProfile {
|
||||
static const _lastServiceGC = 'dateLastServiceGC';
|
||||
final DateTime? lastServiceGC;
|
||||
final DateTime lastServiceGC;
|
||||
static const _lastAccumulatorReset = 'dateLastAccumulatorReset';
|
||||
final DateTime? lastAccumulatorReset;
|
||||
final DateTime lastAccumulatorReset;
|
||||
final S.HeapSpace newSpace;
|
||||
final S.HeapSpace oldSpace;
|
||||
final S.HeapSpace totalSpace;
|
||||
final Iterable<M.ClassHeapStats> members;
|
||||
|
||||
AllocationProfile(S.ServiceMap map,
|
||||
{Map/*<String, List<String>>*/ ? defaults})
|
||||
AllocationProfile(S.ServiceMap map, {Map/*<String, List<String>>*/ defaults})
|
||||
: lastAccumulatorReset = _intString2DateTime(map[_lastAccumulatorReset]),
|
||||
lastServiceGC = _intString2DateTime(map[_lastServiceGC]),
|
||||
oldSpace = new S.HeapSpace()..update(map['_heaps']['old']),
|
||||
|
@ -26,7 +25,7 @@ class AllocationProfile implements M.AllocationProfile {
|
|||
totalSpace.add(newSpace);
|
||||
}
|
||||
|
||||
static DateTime? _intString2DateTime(String milliseconds) {
|
||||
static DateTime _intString2DateTime(String milliseconds) {
|
||||
if ((milliseconds == null) || milliseconds == '') {
|
||||
return null;
|
||||
}
|
||||
|
@ -39,7 +38,7 @@ class AllocationProfile implements M.AllocationProfile {
|
|||
}
|
||||
|
||||
static List<M.ClassHeapStats> _convertMembers(Iterable/*<S.ServiceMap>*/ raw,
|
||||
{Map/*<String, List<String>>*/ ? defaults}) {
|
||||
{Map/*<String, List<String>>*/ defaults}) {
|
||||
final List<M.ClassHeapStats> members =
|
||||
raw.map<ClassHeapStats>(_convertMember).toList();
|
||||
if (defaults == null) {
|
||||
|
@ -50,26 +49,26 @@ class AllocationProfile implements M.AllocationProfile {
|
|||
final Map<String, List<ClassHeapStats>> accumulators =
|
||||
<String, List<ClassHeapStats>>{};
|
||||
defaults.forEach((/*String*/ key, /*List<String>*/ values) {
|
||||
final classes = aliases[key]!;
|
||||
final classes = aliases[key];
|
||||
accumulators.addAll(new Map.fromIterable(values, value: (_) => classes));
|
||||
});
|
||||
final List<M.ClassHeapStats> result = <M.ClassHeapStats>[];
|
||||
members.forEach((M.ClassHeapStats member) {
|
||||
if (accumulators.containsKey(member.clazz!.id)) {
|
||||
accumulators[member.clazz!.id]!.add(member as ClassHeapStats);
|
||||
if (accumulators.containsKey(member.clazz.id)) {
|
||||
accumulators[member.clazz.id].add(member);
|
||||
} else {
|
||||
result.add(member as ClassHeapStats);
|
||||
result.add(member);
|
||||
}
|
||||
});
|
||||
return result
|
||||
..addAll(
|
||||
aliases.keys.map((key) => new ClassesHeapStats(key, aliases[key]!)));
|
||||
aliases.keys.map((key) => new ClassesHeapStats(key, aliases[key])));
|
||||
}
|
||||
}
|
||||
|
||||
class ClassHeapStats implements M.ClassHeapStats {
|
||||
final S.Class? clazz;
|
||||
final String? displayName = null;
|
||||
final S.Class clazz;
|
||||
final String displayName = null;
|
||||
final S.Allocations newSpace;
|
||||
final S.Allocations oldSpace;
|
||||
|
||||
|
@ -80,8 +79,8 @@ class ClassHeapStats implements M.ClassHeapStats {
|
|||
}
|
||||
|
||||
class ClassesHeapStats implements M.ClassHeapStats {
|
||||
final S.Class? clazz = null;
|
||||
final String? displayName;
|
||||
final S.Class clazz = null;
|
||||
final String displayName;
|
||||
final S.Allocations newSpace;
|
||||
final S.Allocations oldSpace;
|
||||
|
||||
|
|
|
@ -7,30 +7,30 @@ part of app;
|
|||
/// The observatory application. Instances of this are created and owned
|
||||
/// by the observatory_application custom element.
|
||||
class ObservatoryApplication {
|
||||
static late ObservatoryApplication app;
|
||||
static ObservatoryApplication app;
|
||||
final RenderingQueue queue = new RenderingQueue();
|
||||
final TargetRepository targets = new TargetRepository(isConnectedVMTarget);
|
||||
final EventRepository events = new EventRepository();
|
||||
final NotificationRepository notifications = new NotificationRepository();
|
||||
final _pageRegistry = <Page>[];
|
||||
late LocationManager _locationManager;
|
||||
LocationManager _locationManager;
|
||||
LocationManager get locationManager => _locationManager;
|
||||
Page? currentPage;
|
||||
Page currentPage;
|
||||
bool _vmConnected = false;
|
||||
VM? _vm;
|
||||
VM get vm => _vm!;
|
||||
VM _vm;
|
||||
VM get vm => _vm;
|
||||
|
||||
static bool isConnectedVMTarget(M.Target target) {
|
||||
if (app._vm is CommonWebSocketVM) {
|
||||
if ((app._vm as CommonWebSocketVM).target == target) {
|
||||
return app._vm!.isConnected;
|
||||
return app._vm.isConnected;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
_switchVM(VM? newVM) {
|
||||
final VM? oldVM = _vm;
|
||||
_switchVM(VM newVM) {
|
||||
final VM oldVM = _vm;
|
||||
|
||||
Logger.root.info('_switchVM from:${oldVM} to:${newVM}');
|
||||
|
||||
|
@ -89,14 +89,14 @@ class ObservatoryApplication {
|
|||
_vm = newVM;
|
||||
}
|
||||
|
||||
StreamSubscription? _gcSubscription;
|
||||
StreamSubscription? _loggingSubscription;
|
||||
StreamSubscription _gcSubscription;
|
||||
StreamSubscription _loggingSubscription;
|
||||
|
||||
Future startGCEventListener() async {
|
||||
if (_gcSubscription != null || _vm == null) {
|
||||
return;
|
||||
}
|
||||
_gcSubscription = await _vm!.listenEventStream(VM.kGCStream, _onEvent);
|
||||
_gcSubscription = await _vm.listenEventStream(VM.kGCStream, _onEvent);
|
||||
}
|
||||
|
||||
Future startLoggingEventListener() async {
|
||||
|
@ -104,14 +104,14 @@ class ObservatoryApplication {
|
|||
return;
|
||||
}
|
||||
_loggingSubscription =
|
||||
await _vm!.listenEventStream(Isolate.kLoggingStream, _onEvent);
|
||||
await _vm.listenEventStream(Isolate.kLoggingStream, _onEvent);
|
||||
}
|
||||
|
||||
Future stopGCEventListener() async {
|
||||
if (_gcSubscription == null) {
|
||||
return;
|
||||
}
|
||||
_gcSubscription!.cancel();
|
||||
_gcSubscription.cancel();
|
||||
_gcSubscription = null;
|
||||
}
|
||||
|
||||
|
@ -119,15 +119,16 @@ class ObservatoryApplication {
|
|||
if (_loggingSubscription == null) {
|
||||
return;
|
||||
}
|
||||
_loggingSubscription!.cancel();
|
||||
_loggingSubscription.cancel();
|
||||
_loggingSubscription = null;
|
||||
}
|
||||
|
||||
final ObservatoryApplicationElement rootElement;
|
||||
|
||||
ServiceObject? lastErrorOrException;
|
||||
ServiceObject lastErrorOrException;
|
||||
|
||||
void _initOnce() {
|
||||
assert(app == null);
|
||||
app = this;
|
||||
_registerPages();
|
||||
Analytics.initialize();
|
||||
|
@ -145,7 +146,7 @@ class ObservatoryApplication {
|
|||
|
||||
void _onEvent(ServiceEvent event) {
|
||||
assert(event.kind != ServiceEvent.kNone);
|
||||
M.Event? e = createEventFromServiceEvent(event);
|
||||
M.Event e = createEventFromServiceEvent(event);
|
||||
if (e != null) {
|
||||
events.add(e);
|
||||
}
|
||||
|
@ -178,7 +179,7 @@ class ObservatoryApplication {
|
|||
_pageRegistry.add(new ErrorPage(this));
|
||||
}
|
||||
|
||||
void _visit(Uri uri, Map<String, String> internalArguments) {
|
||||
void _visit(Uri uri, Map internalArguments) {
|
||||
if (internalArguments['trace'] != null) {
|
||||
var traceArg = internalArguments['trace'];
|
||||
if (traceArg == 'on') {
|
||||
|
@ -188,7 +189,7 @@ class ObservatoryApplication {
|
|||
}
|
||||
}
|
||||
if (Tracer.current != null) {
|
||||
Tracer.current!.reset();
|
||||
Tracer.current.reset();
|
||||
}
|
||||
for (var i = 0; i < _pageRegistry.length; i++) {
|
||||
var page = _pageRegistry[i];
|
||||
|
@ -210,7 +211,7 @@ class ObservatoryApplication {
|
|||
}
|
||||
if (currentPage != null) {
|
||||
Logger.root.info('Uninstalling page: $currentPage');
|
||||
currentPage!.onUninstall();
|
||||
currentPage.onUninstall();
|
||||
// Clear children.
|
||||
rootElement.children.clear();
|
||||
}
|
||||
|
@ -221,7 +222,7 @@ class ObservatoryApplication {
|
|||
Logger.root.severe('Failed to install page: $e');
|
||||
}
|
||||
// Add new page.
|
||||
rootElement.children.add(page.element!);
|
||||
rootElement.children.add(page.element);
|
||||
|
||||
// Remember page.
|
||||
currentPage = page;
|
||||
|
@ -238,22 +239,22 @@ class ObservatoryApplication {
|
|||
_switchVM(null);
|
||||
} else {
|
||||
final bool currentTarget =
|
||||
(_vm as WebSocketVM?)?.target == targets.current;
|
||||
final bool currentTargetConnected = (_vm != null) && _vm!.isConnected;
|
||||
(_vm as WebSocketVM)?.target == targets.current;
|
||||
final bool currentTargetConnected = (_vm != null) && _vm.isConnected;
|
||||
if (!currentTarget || !currentTargetConnected) {
|
||||
_switchVM(new WebSocketVM(targets.current!));
|
||||
_vm!.onConnect.then((_) {
|
||||
_switchVM(new WebSocketVM(targets.current));
|
||||
_vm.onConnect.then((_) {
|
||||
app.locationManager.go(Uris.vm());
|
||||
});
|
||||
_vm!.load();
|
||||
_vm.load();
|
||||
} else if (currentTargetConnected) {
|
||||
app.locationManager.go(Uris.vm());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Logger.root.info('Setting initial target to ${targets.current!.name}');
|
||||
_switchVM(new WebSocketVM(targets.current!));
|
||||
Logger.root.info('Setting initial target to ${targets.current.name}');
|
||||
_switchVM(new WebSocketVM(targets.current));
|
||||
_initOnce();
|
||||
|
||||
// delete pause events.
|
||||
|
|
|
@ -11,11 +11,11 @@ class LocationManager {
|
|||
/// application URL.
|
||||
final Map<String, String> internalArguments = new Map<String, String>();
|
||||
|
||||
Uri? _uri;
|
||||
Uri _uri;
|
||||
|
||||
/// [uri] is the application uri. Application uris consist of a path and
|
||||
/// the queryParameters map.
|
||||
Uri get uri => _uri!;
|
||||
Uri get uri => _uri;
|
||||
|
||||
LocationManager(this._app) {
|
||||
window.onPopState.listen(_onBrowserNavigation);
|
||||
|
@ -90,14 +90,13 @@ class LocationManager {
|
|||
|
||||
/// Notify the current page that something has changed.
|
||||
_visit() {
|
||||
Chain.capture(() => _app._visit(_uri!, internalArguments),
|
||||
onError: (e, st) {
|
||||
Chain.capture(() => _app._visit(_uri, internalArguments), onError: (e, st) {
|
||||
if (e is IsolateNotFound) {
|
||||
var newPath = ((_app.vm == null || _app.vm.isDisconnected)
|
||||
? '/vm-connect'
|
||||
: '/isolate-reconnect');
|
||||
var parameters = <String, dynamic>{};
|
||||
parameters.addAll(_uri!.queryParameters);
|
||||
parameters.addAll(_uri.queryParameters);
|
||||
parameters['originalUri'] = _uri.toString();
|
||||
parameters['isolateId'] = parameters['isolateId'];
|
||||
var generatedUri = new Uri(path: newPath, queryParameters: parameters);
|
||||
|
@ -127,7 +126,7 @@ class LocationManager {
|
|||
}
|
||||
|
||||
makeLinkReplacingParameters(Map updatedParameters) {
|
||||
var parameters = new Map<String, dynamic>.from(_uri!.queryParameters);
|
||||
var parameters = new Map.from(_uri.queryParameters);
|
||||
updatedParameters.forEach((k, v) {
|
||||
parameters[k] = v;
|
||||
});
|
||||
|
@ -142,7 +141,7 @@ class LocationManager {
|
|||
}
|
||||
|
||||
makeLinkForwardingParameters(String newPath) {
|
||||
var parameters = _uri!.queryParameters;
|
||||
var parameters = _uri.queryParameters;
|
||||
var generatedUri = new Uri(path: newPath, queryParameters: parameters);
|
||||
return makeLink(generatedUri.toString());
|
||||
}
|
||||
|
@ -162,7 +161,7 @@ class LocationManager {
|
|||
event.preventDefault();
|
||||
// 'currentTarget' is the dom element that would process the event.
|
||||
// If we use 'target' we might get an <em> element or somesuch.
|
||||
Element target = event.currentTarget as Element;
|
||||
go(target.attributes['href']!);
|
||||
Element target = event.currentTarget;
|
||||
go(target.attributes['href']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class ExceptionNotification implements M.ExceptionNotification {
|
|||
final exception;
|
||||
|
||||
/// [optional]
|
||||
final StackTrace? stacktrace;
|
||||
final StackTrace stacktrace;
|
||||
ExceptionNotification(this.exception, {this.stacktrace});
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ RetainingPathRepository _retainingPathRepository =
|
|||
abstract class Page {
|
||||
final ObservatoryApplication app;
|
||||
final Map<String, String> internalArguments = <String, String>{};
|
||||
HtmlElement? element;
|
||||
HtmlElement element;
|
||||
|
||||
Page(this.app);
|
||||
|
||||
|
@ -70,7 +70,7 @@ abstract class Page {
|
|||
}
|
||||
|
||||
/// Called when the page should update its state based on [uri].
|
||||
void visit(Uri uri, Map<String, String> internalArguments) {
|
||||
void visit(Uri uri, Map internalArguments) {
|
||||
this.internalArguments.clear();
|
||||
this.internalArguments.addAll(internalArguments);
|
||||
Analytics.reportPageView(uri);
|
||||
|
@ -96,7 +96,7 @@ abstract class MatchingPage extends Page {
|
|||
|
||||
Future<Isolate> getIsolate(Uri uri) {
|
||||
var isolateId = uri.queryParameters['isolateId'];
|
||||
return app.vm.getIsolate(isolateId!).then((isolate) {
|
||||
return app.vm.getIsolate(isolateId).then((isolate) {
|
||||
if (isolate == null) {
|
||||
throw new IsolateNotFound(isolateId);
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ abstract class MatchingPage extends Page {
|
|||
EditorRepository getEditor(Uri uri) {
|
||||
final editor = uri.queryParameters['editor'];
|
||||
return new EditorRepository(app.vm, editor: editor);
|
||||
return null;
|
||||
}
|
||||
|
||||
bool canVisit(Uri uri) => uri.path == path;
|
||||
|
@ -119,7 +120,7 @@ class SimplePage extends MatchingPage {
|
|||
|
||||
void onInstall() {
|
||||
if (element == null) {
|
||||
element = new Element.tag(elementTagName) as HtmlElement;
|
||||
element = new Element.tag(elementTagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +170,7 @@ class VMPage extends MatchingPage {
|
|||
return;
|
||||
}
|
||||
app.vm.reload().then((serviceObject) {
|
||||
VM vm = serviceObject as VM;
|
||||
VM vm = serviceObject;
|
||||
container.children = <Element>[
|
||||
new VMViewElement(
|
||||
vm,
|
||||
|
@ -257,7 +258,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new ClassViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -280,7 +281,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new CodeViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -296,7 +297,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new ContextViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -317,7 +318,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new FieldViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -336,7 +337,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new InstanceViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -374,7 +375,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new FunctionViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -393,7 +394,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new ICDataViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -410,7 +411,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new SingleTargetCacheViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -427,7 +428,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new SubtypeTestCacheViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -444,7 +445,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new UnlinkedCallViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -461,7 +462,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new LibraryViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -481,7 +482,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new MegamorphicCacheViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -498,7 +499,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new ObjectPoolViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -515,13 +516,13 @@ class InspectPage extends MatchingPage {
|
|||
var pos;
|
||||
if (app.locationManager.internalArguments['pos'] != null) {
|
||||
try {
|
||||
pos = int.parse(app.locationManager.internalArguments['pos']!);
|
||||
pos = int.parse(app.locationManager.internalArguments['pos']);
|
||||
} catch (_) {}
|
||||
}
|
||||
container.children = <Element>[
|
||||
new ScriptViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -539,7 +540,7 @@ class InspectPage extends MatchingPage {
|
|||
container.children = <Element>[
|
||||
new ObjectViewElement(
|
||||
app.vm,
|
||||
obj.isolate as Isolate,
|
||||
obj.isolate,
|
||||
obj,
|
||||
app.events,
|
||||
app.notifications,
|
||||
|
@ -553,8 +554,8 @@ class InspectPage extends MatchingPage {
|
|||
];
|
||||
} else if (obj is Sentinel) {
|
||||
container.children = <Element>[
|
||||
new SentinelViewElement(app.vm, obj.isolate as Isolate, obj, app.events,
|
||||
app.notifications,
|
||||
new SentinelViewElement(
|
||||
app.vm, obj.isolate, obj, app.events, app.notifications,
|
||||
queue: app.queue)
|
||||
.element
|
||||
];
|
||||
|
@ -911,8 +912,8 @@ class IsolateReconnectPage extends Page {
|
|||
app.vm,
|
||||
app.events,
|
||||
app.notifications,
|
||||
uri.queryParameters['isolateId']!,
|
||||
Uri.parse(uri.queryParameters['originalUri']!))
|
||||
uri.queryParameters['isolateId'],
|
||||
Uri.parse(uri.queryParameters['originalUri']))
|
||||
.element
|
||||
];
|
||||
assert(element != null);
|
||||
|
@ -927,7 +928,7 @@ class MetricsPage extends MatchingPage {
|
|||
|
||||
final DivElement container = new DivElement();
|
||||
|
||||
Isolate? lastIsolate;
|
||||
Isolate lastIsolate;
|
||||
|
||||
void _visit(Uri uri) {
|
||||
super._visit(uri);
|
||||
|
@ -953,7 +954,7 @@ class MetricsPage extends MatchingPage {
|
|||
@override
|
||||
void onUninstall() {
|
||||
super.onUninstall();
|
||||
_metricRepository.stopSampling(lastIsolate!);
|
||||
_metricRepository.stopSampling(lastIsolate);
|
||||
container.children = const [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ abstract class _CommandBase {
|
|||
// A command may optionally have sub-commands.
|
||||
List<Command> _children = <Command>[];
|
||||
|
||||
_CommandBase? _parent;
|
||||
int get _depth => (_parent == null ? 0 : _parent!._depth + 1);
|
||||
_CommandBase _parent;
|
||||
int get _depth => (_parent == null ? 0 : _parent._depth + 1);
|
||||
|
||||
// Override in subclasses to provide command-specific argument completion.
|
||||
//
|
||||
|
@ -115,7 +115,7 @@ abstract class _CommandBase {
|
|||
|
||||
// The root of a tree of commands.
|
||||
class RootCommand extends _CommandBase {
|
||||
RootCommand(List<Command> children, [List<String>? history])
|
||||
RootCommand(List<Command> children, [List<String> history])
|
||||
: this._(children, history ?? ['']);
|
||||
|
||||
RootCommand._(List<Command> children, List<String> history)
|
||||
|
@ -161,7 +161,7 @@ class RootCommand extends _CommandBase {
|
|||
// If we are showing all possiblities, also include local
|
||||
// completions for the parent command.
|
||||
return commands[0]
|
||||
._parent!
|
||||
._parent
|
||||
._buildCompletions(args, false)
|
||||
.then((localCompletions) {
|
||||
completions.addAll(localCompletions);
|
||||
|
@ -232,7 +232,7 @@ class RootCommand extends _CommandBase {
|
|||
throw 'should-not-execute-the-root-command';
|
||||
}
|
||||
|
||||
String toString() => 'RootCommand';
|
||||
toString() => 'RootCommand';
|
||||
}
|
||||
|
||||
// A node in the command tree.
|
||||
|
@ -240,18 +240,18 @@ abstract class Command extends _CommandBase {
|
|||
Command(this.name, List<Command> children) : super(children);
|
||||
|
||||
final String name;
|
||||
String? alias;
|
||||
String alias;
|
||||
|
||||
String get fullName {
|
||||
if (_parent is RootCommand) {
|
||||
return name;
|
||||
} else {
|
||||
Command parent = _parent as Command;
|
||||
Command parent = _parent;
|
||||
return '${parent.fullName} $name';
|
||||
}
|
||||
}
|
||||
|
||||
String toString() => 'Command(${name})';
|
||||
toString() => 'Command(${name})';
|
||||
}
|
||||
|
||||
abstract class CommandException implements Exception {}
|
||||
|
|
|
@ -8,7 +8,7 @@ part of debugger;
|
|||
abstract class Debugger {
|
||||
VM get vm;
|
||||
Isolate get isolate;
|
||||
M.ObjectRepository? objects;
|
||||
ServiceMap? get stack;
|
||||
int? get currentFrame;
|
||||
M.ObjectRepository objects;
|
||||
ServiceMap get stack;
|
||||
int get currentFrame;
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ class DebuggerLocation {
|
|||
new DebuggerLocation.error("Invalid source location '${locDesc}'"));
|
||||
}
|
||||
|
||||
static Future<Frame?> _currentFrame(Debugger debugger) async {
|
||||
ServiceMap? stack = debugger.stack;
|
||||
static Future<Frame> _currentFrame(Debugger debugger) async {
|
||||
ServiceMap stack = debugger.stack;
|
||||
if (stack == null || stack['frames'].length == 0) {
|
||||
return null;
|
||||
}
|
||||
return stack['frames'][debugger.currentFrame] as Frame?;
|
||||
return stack['frames'][debugger.currentFrame];
|
||||
}
|
||||
|
||||
static Future<DebuggerLocation> _currentLocation(Debugger debugger) async {
|
||||
|
@ -64,10 +64,10 @@ class DebuggerLocation {
|
|||
return new DebuggerLocation.error(
|
||||
'A script must be provided when the stack is empty');
|
||||
}
|
||||
Script script = frame.location!.script;
|
||||
Script script = frame.location.script;
|
||||
await script.load();
|
||||
var line = script.tokenToLine(frame.location!.tokenPos);
|
||||
var col = script.tokenToCol(frame.location!.tokenPos);
|
||||
var line = script.tokenToLine(frame.location.tokenPos);
|
||||
var col = script.tokenToCol(frame.location.tokenPos);
|
||||
return new DebuggerLocation.file(script, line, col);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class DebuggerLocation {
|
|||
if (colStr != null) {
|
||||
colStr = colStr.substring(1);
|
||||
}
|
||||
var line = int.tryParse(lineStr!) ?? -1;
|
||||
var line = int.tryParse(lineStr) ?? -1;
|
||||
var col = (colStr != null ? int.tryParse(colStr) ?? -1 : null);
|
||||
if (line == -1) {
|
||||
return new Future.value(
|
||||
|
@ -121,7 +121,7 @@ class DebuggerLocation {
|
|||
return new Future.value(new DebuggerLocation.error(
|
||||
'A script must be provided when the stack is empty'));
|
||||
}
|
||||
Script script = frame.location!.script;
|
||||
Script script = frame.location.script;
|
||||
await script.load();
|
||||
return new DebuggerLocation.file(script, line, col);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class DebuggerLocation {
|
|||
var matches = <Script>{};
|
||||
for (var lib in isolate.libraries) {
|
||||
for (var script in lib.scripts) {
|
||||
final String haystack = useUri ? script.uri : script.name!;
|
||||
final String haystack = useUri ? script.uri : script.name;
|
||||
if (allowPrefix) {
|
||||
if (haystack.startsWith(name)) {
|
||||
matches.add(script);
|
||||
|
@ -162,7 +162,7 @@ class DebuggerLocation {
|
|||
assert(lib.loaded);
|
||||
for (var function in lib.functions) {
|
||||
if (allowPrefix) {
|
||||
if (function.name!.startsWith(name)) {
|
||||
if (function.name.startsWith(name)) {
|
||||
matches.add(function);
|
||||
}
|
||||
} else {
|
||||
|
@ -194,7 +194,7 @@ class DebuggerLocation {
|
|||
for (var lib in isolate.libraries) {
|
||||
for (var cls in lib.classes) {
|
||||
if (allowPrefix) {
|
||||
if (cls.name!.startsWith(name)) {
|
||||
if (cls.name.startsWith(name)) {
|
||||
matches.add(cls);
|
||||
}
|
||||
} else {
|
||||
|
@ -207,7 +207,7 @@ class DebuggerLocation {
|
|||
return matches;
|
||||
}
|
||||
|
||||
static ServiceFunction? _getConstructor(Class cls, String name) {
|
||||
static ServiceFunction _getConstructor(Class cls, String name) {
|
||||
for (var function in cls.functions) {
|
||||
assert(cls.loaded);
|
||||
if (name == function.name) {
|
||||
|
@ -222,7 +222,7 @@ class DebuggerLocation {
|
|||
static Future<DebuggerLocation> _parseFunction(
|
||||
Debugger debugger, Match match) {
|
||||
Isolate isolate = debugger.isolate;
|
||||
var base = match.group(1)!;
|
||||
var base = match.group(1);
|
||||
var qualifier = match.group(2);
|
||||
assert(base != null);
|
||||
|
||||
|
@ -234,7 +234,7 @@ class DebuggerLocation {
|
|||
|
||||
for (var cls in classes) {
|
||||
// Look for a self-named constructor.
|
||||
var constructor = _getConstructor(cls, cls.name!);
|
||||
var constructor = _getConstructor(cls, cls.name);
|
||||
if (constructor != null) {
|
||||
functions.add(constructor);
|
||||
}
|
||||
|
@ -300,8 +300,9 @@ class DebuggerLocation {
|
|||
static Future<List<String>> _completeFunction(
|
||||
Debugger debugger, Match match) {
|
||||
Isolate isolate = debugger.isolate;
|
||||
var base = match.group(1) ?? '';
|
||||
var base = match.group(1);
|
||||
var qualifier = match.group(2);
|
||||
base = (base == null ? '' : base);
|
||||
|
||||
if (qualifier == null) {
|
||||
return _lookupClass(isolate, base, allowPrefix: true).then((classes) {
|
||||
|
@ -309,12 +310,12 @@ class DebuggerLocation {
|
|||
|
||||
// Complete top-level function names.
|
||||
var functions = _lookupFunction(isolate, base, allowPrefix: true);
|
||||
var funcNames = functions.map((f) => f.name!).toList();
|
||||
var funcNames = functions.map((f) => f.name).toList();
|
||||
funcNames.sort();
|
||||
completions.addAll(funcNames);
|
||||
|
||||
// Complete class names.
|
||||
var classNames = classes.map((f) => f.name!).toList();
|
||||
var classNames = classes.map((f) => f.name).toList();
|
||||
classNames.sort();
|
||||
completions.addAll(classNames);
|
||||
|
||||
|
@ -326,12 +327,12 @@ class DebuggerLocation {
|
|||
for (var cls in classes) {
|
||||
for (var function in cls.functions) {
|
||||
if (function.kind == M.FunctionKind.constructor) {
|
||||
if (function.name!.startsWith(match.group(0)!)) {
|
||||
completions.add(function.name!);
|
||||
if (function.name.startsWith(match.group(0))) {
|
||||
completions.add(function.name);
|
||||
}
|
||||
} else {
|
||||
if (function.qualifiedName!.startsWith(match.group(0)!)) {
|
||||
completions.add(function.qualifiedName!);
|
||||
if (function.qualifiedName.startsWith(match.group(0))) {
|
||||
completions.add(function.qualifiedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,29 +354,34 @@ class DebuggerLocation {
|
|||
var lineStr;
|
||||
var lineStrComplete = false;
|
||||
var colStr;
|
||||
if (_startsWithDigit(match.group(1)!)) {
|
||||
if (_startsWithDigit(match.group(1))) {
|
||||
// CASE 1: We have matched a prefix of (lineStr:)(colStr)
|
||||
var frame = await _currentFrame(debugger);
|
||||
if (frame == null) {
|
||||
return [];
|
||||
}
|
||||
scriptName = frame.location!.script.name;
|
||||
scriptName = frame.location.script.name;
|
||||
scriptNameComplete = true;
|
||||
lineStr = match.group(1) ?? '';
|
||||
lineStr = match.group(1);
|
||||
lineStr = (lineStr == null ? '' : lineStr);
|
||||
if (lineStr.endsWith(':')) {
|
||||
lineStr = lineStr.substring(0, lineStr.length - 1);
|
||||
lineStrComplete = true;
|
||||
}
|
||||
colStr = match.group(2) ?? '';
|
||||
colStr = match.group(2);
|
||||
colStr = (colStr == null ? '' : colStr);
|
||||
} else {
|
||||
// CASE 2: We have matched a prefix of (scriptName:)(lineStr)(:colStr)
|
||||
scriptName = match.group(1) ?? '';
|
||||
scriptName = match.group(1);
|
||||
scriptName = (scriptName == null ? '' : scriptName);
|
||||
if (scriptName.endsWith(':')) {
|
||||
scriptName = scriptName.substring(0, scriptName.length - 1);
|
||||
scriptNameComplete = true;
|
||||
}
|
||||
lineStr = match.group(2) ?? '';
|
||||
colStr = match.group(3) ?? '';
|
||||
lineStr = match.group(2);
|
||||
lineStr = (lineStr == null ? '' : lineStr);
|
||||
colStr = match.group(3);
|
||||
colStr = (colStr == null ? '' : colStr);
|
||||
if (colStr.startsWith(':')) {
|
||||
lineStrComplete = true;
|
||||
colStr = colStr.substring(1);
|
||||
|
@ -388,7 +394,7 @@ class DebuggerLocation {
|
|||
await _lookupScript(debugger.isolate, scriptName, allowPrefix: true);
|
||||
var completions = <String>[];
|
||||
for (var script in scripts) {
|
||||
completions.add(script.name! + ':');
|
||||
completions.add(script.name + ':');
|
||||
}
|
||||
completions.sort();
|
||||
return completions;
|
||||
|
@ -405,8 +411,8 @@ class DebuggerLocation {
|
|||
// Complete the line.
|
||||
var sharedPrefix = '${script.name}:';
|
||||
var completions = <String>[];
|
||||
var report = await script.isolate!.getSourceReport(
|
||||
[Isolate.kPossibleBreakpointsReport], script) as ServiceMap;
|
||||
var report = await script.isolate
|
||||
.getSourceReport([Isolate.kPossibleBreakpointsReport], script);
|
||||
Set<int> possibleBpts = getPossibleBreakpointLines(report, script);
|
||||
for (var line in possibleBpts) {
|
||||
var currentLineStr = line.toString();
|
||||
|
@ -419,7 +425,7 @@ class DebuggerLocation {
|
|||
} else {
|
||||
// Complete the column.
|
||||
int lineNum = int.parse(lineStr);
|
||||
var scriptLine = script.getLine(lineNum)!;
|
||||
var scriptLine = script.getLine(lineNum);
|
||||
var sharedPrefix = '${script.name}:${lineStr}:';
|
||||
var completions = <String>[];
|
||||
int maxCol = scriptLine.text.trimRight().runes.length;
|
||||
|
@ -437,20 +443,20 @@ class DebuggerLocation {
|
|||
String toString() {
|
||||
if (valid) {
|
||||
if (function != null) {
|
||||
return '${function!.qualifiedName}';
|
||||
return '${function.qualifiedName}';
|
||||
} else if (col != null) {
|
||||
return '${script!.name}:${line}:${col}';
|
||||
return '${script.name}:${line}:${col}';
|
||||
} else {
|
||||
return '${script!.name}:${line}';
|
||||
return '${script.name}:${line}';
|
||||
}
|
||||
}
|
||||
return 'invalid source location (${errorMessage})';
|
||||
}
|
||||
|
||||
Script? script;
|
||||
int? line;
|
||||
int? col;
|
||||
ServiceFunction? function;
|
||||
String? errorMessage;
|
||||
Script script;
|
||||
int line;
|
||||
int col;
|
||||
ServiceFunction function;
|
||||
String errorMessage;
|
||||
bool get valid => (errorMessage == null);
|
||||
}
|
||||
|
|
|
@ -48,20 +48,20 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
VirtualCollectionElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<AllocationProfileElement> _r;
|
||||
RenderingScheduler<AllocationProfileElement> _r;
|
||||
|
||||
Stream<RenderedEvent<AllocationProfileElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.AllocationProfileRepository _repository;
|
||||
M.AllocationProfile? _profile;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.AllocationProfileRepository _repository;
|
||||
M.AllocationProfile _profile;
|
||||
bool _autoRefresh = false;
|
||||
bool _isCompacted = false;
|
||||
late StreamSubscription _gcSubscription;
|
||||
StreamSubscription _gcSubscription;
|
||||
_SortingField _sortingField = _SortingField.size;
|
||||
_SortingDirection _sortingDirection = _SortingDirection.descending;
|
||||
|
||||
|
@ -75,7 +75,7 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.AllocationProfileRepository repository,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -174,9 +174,9 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
..text = 'last forced GC at',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..text = _profile!.lastServiceGC == null
|
||||
..text = _profile.lastServiceGC == null
|
||||
? '---'
|
||||
: '${_profile!.lastServiceGC}',
|
||||
: '${_profile.lastServiceGC}',
|
||||
],
|
||||
],
|
||||
new HRElement(),
|
||||
|
@ -190,14 +190,14 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
? [
|
||||
new HeadingElement.h2()
|
||||
..text = 'New Generation '
|
||||
'(${_usedCaption(_profile!.newSpace)})',
|
||||
'(${_usedCaption(_profile.newSpace)})',
|
||||
]
|
||||
: [
|
||||
new HeadingElement.h2()..text = 'New Generation',
|
||||
new BRElement(),
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _createSpaceMembers(_profile!.newSpace),
|
||||
..children = _createSpaceMembers(_profile.newSpace),
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['heap-space', 'left']
|
||||
|
@ -205,14 +205,14 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
? [
|
||||
new HeadingElement.h2()
|
||||
..text = 'Old Generation '
|
||||
'(${_usedCaption(_profile!.oldSpace)})',
|
||||
'(${_usedCaption(_profile.oldSpace)})',
|
||||
]
|
||||
: [
|
||||
new HeadingElement.h2()..text = 'Old Generation',
|
||||
new BRElement(),
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _createSpaceMembers(_profile!.oldSpace),
|
||||
..children = _createSpaceMembers(_profile.oldSpace),
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['heap-space', 'left']
|
||||
|
@ -220,22 +220,22 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
? [
|
||||
new HeadingElement.h2()
|
||||
..text = 'Total '
|
||||
'(${_usedCaption(_profile!.totalSpace)})',
|
||||
'(${_usedCaption(_profile.totalSpace)})',
|
||||
]
|
||||
: [
|
||||
new HeadingElement.h2()..text = 'Total',
|
||||
new BRElement(),
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _createSpaceMembers(_profile!.totalSpace),
|
||||
..children = _createSpaceMembers(_profile.totalSpace),
|
||||
],
|
||||
new ButtonElement()
|
||||
..classes = ['compact']
|
||||
..text = _isCompacted ? 'expand ▼' : 'compact ▲'
|
||||
..onClick.listen((_) {
|
||||
_isCompacted = !_isCompacted;
|
||||
_r.dirty();
|
||||
}),
|
||||
_isCompacted = !_isCompacted;
|
||||
_r.dirty();
|
||||
}),
|
||||
new HRElement()
|
||||
],
|
||||
new DivElement()
|
||||
|
@ -245,7 +245,7 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
_createCollectionLine, _updateCollectionLine,
|
||||
createHeader: _createCollectionHeader,
|
||||
search: _search,
|
||||
items: _profile!.members.toList()..sort(_createSorter()),
|
||||
items: _profile.members.toList()..sort(_createSorter()),
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -293,7 +293,7 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
getter = _getInstances;
|
||||
break;
|
||||
case _SortingField.className:
|
||||
getter = (M.ClassHeapStats s) => s.clazz!.name;
|
||||
getter = (M.ClassHeapStats s) => s.clazz.name;
|
||||
break;
|
||||
}
|
||||
switch (_sortingDirection) {
|
||||
|
@ -376,26 +376,35 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
_SortingField.newInternalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'External',
|
||||
_SortingField.newExternalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'Size', _SortingField.newSize,
|
||||
_createHeaderButton(const ['bytes'], 'Size',
|
||||
_SortingField.newSize, _SortingDirection.descending),
|
||||
_createHeaderButton(
|
||||
const ['instances'], 'Instances',
|
||||
_SortingField.newInstances,
|
||||
_SortingDirection.descending),
|
||||
_createHeaderButton(const ['instances'], 'Instances',
|
||||
_SortingField.newInstances, _SortingDirection.descending),
|
||||
|
||||
_createHeaderButton(const ['bytes'], 'Internal',
|
||||
_SortingField.oldInternalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'External',
|
||||
_SortingField.oldExternalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'Size', _SortingField.oldSize,
|
||||
_createHeaderButton(const ['bytes'], 'Size',
|
||||
_SortingField.oldSize, _SortingDirection.descending),
|
||||
_createHeaderButton(
|
||||
const ['instances'], 'Instances',
|
||||
_SortingField.oldInstances,
|
||||
_SortingDirection.descending),
|
||||
_createHeaderButton(const ['instances'], 'Instances',
|
||||
_SortingField.oldInstances, _SortingDirection.descending),
|
||||
|
||||
_createHeaderButton(const ['bytes'], 'Internal',
|
||||
_SortingField.internalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'External',
|
||||
_SortingField.externalSize, _SortingDirection.descending),
|
||||
_createHeaderButton(const ['bytes'], 'Size', _SortingField.size,
|
||||
_createHeaderButton(const ['bytes'], 'Size',
|
||||
_SortingField.size, _SortingDirection.descending),
|
||||
_createHeaderButton(
|
||||
const ['instances'], 'Instances',
|
||||
_SortingField.instances,
|
||||
_SortingDirection.descending),
|
||||
_createHeaderButton(const ['instances'], 'Instances',
|
||||
_SortingField.instances, _SortingDirection.descending),
|
||||
|
||||
_createHeaderButton(const ['name'], 'Class',
|
||||
_SortingField.className, _SortingDirection.ascending)
|
||||
],
|
||||
|
@ -443,14 +452,14 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
e.children[9].text = Utils.formatSize(_getExternalSize(item));
|
||||
e.children[10].text = Utils.formatSize(_getSize(item));
|
||||
e.children[11].text = '${_getInstances(item)}';
|
||||
e.children[12] = new ClassRefElement(_isolate, item.clazz!, queue: _r.queue)
|
||||
e.children[12] = new ClassRefElement(_isolate, item.clazz, queue: _r.queue)
|
||||
.element
|
||||
..classes = ['name'];
|
||||
}
|
||||
|
||||
bool _search(Pattern pattern, itemDynamic) {
|
||||
M.ClassHeapStats item = itemDynamic;
|
||||
return item.clazz!.name!.contains(pattern);
|
||||
return item.clazz.name.contains(pattern);
|
||||
}
|
||||
|
||||
static String _usedCaption(M.HeapSpace space) =>
|
||||
|
@ -537,11 +546,11 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
'Class'
|
||||
].join(',') +
|
||||
'\n';
|
||||
AnchorElement tl = document.createElement('a') as AnchorElement;
|
||||
AnchorElement tl = document.createElement('a');
|
||||
tl
|
||||
..attributes['href'] = 'data:text/plain;charset=utf-8,' +
|
||||
Uri.encodeComponent(header +
|
||||
(_profile!.members.toList()..sort(_createSorter()))
|
||||
(_profile.members.toList()..sort(_createSorter()))
|
||||
.map(_csvOut)
|
||||
.join('\n'))
|
||||
..attributes['download'] = 'heap-profile.csv'
|
||||
|
@ -562,23 +571,32 @@ class AllocationProfileElement extends CustomElement implements Renderable {
|
|||
_getExternalSize(s),
|
||||
_getSize(s),
|
||||
_getInstances(s),
|
||||
s.clazz!.name
|
||||
s.clazz.name
|
||||
].join(',');
|
||||
}
|
||||
|
||||
static int _getNewInstances(M.ClassHeapStats s) => s.newSpace.instances;
|
||||
static int _getNewInternalSize(M.ClassHeapStats s) => s.newSpace.internalSize;
|
||||
static int _getNewExternalSize(M.ClassHeapStats s) => s.newSpace.externalSize;
|
||||
static int _getNewSize(M.ClassHeapStats s) => s.newSpace.size;
|
||||
static int _getOldInstances(M.ClassHeapStats s) => s.oldSpace.instances;
|
||||
static int _getOldInternalSize(M.ClassHeapStats s) => s.oldSpace.internalSize;
|
||||
static int _getOldExternalSize(M.ClassHeapStats s) => s.oldSpace.externalSize;
|
||||
static int _getOldSize(M.ClassHeapStats s) => s.oldSpace.size;
|
||||
static int _getNewInstances(M.ClassHeapStats s) =>
|
||||
s.newSpace.instances;
|
||||
static int _getNewInternalSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.internalSize;
|
||||
static int _getNewExternalSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.externalSize;
|
||||
static int _getNewSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.size;
|
||||
static int _getOldInstances(M.ClassHeapStats s) =>
|
||||
s.oldSpace.instances;
|
||||
static int _getOldInternalSize(M.ClassHeapStats s) =>
|
||||
s.oldSpace.internalSize;
|
||||
static int _getOldExternalSize(M.ClassHeapStats s) =>
|
||||
s.oldSpace.externalSize;
|
||||
static int _getOldSize(M.ClassHeapStats s) =>
|
||||
s.oldSpace.size;
|
||||
static int _getInstances(M.ClassHeapStats s) =>
|
||||
s.newSpace.instances + s.oldSpace.instances;
|
||||
static int _getInternalSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.internalSize + s.oldSpace.internalSize;
|
||||
static int _getExternalSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.externalSize + s.oldSpace.externalSize;
|
||||
static int _getSize(M.ClassHeapStats s) => s.newSpace.size + s.oldSpace.size;
|
||||
static int _getSize(M.ClassHeapStats s) =>
|
||||
s.newSpace.size + s.oldSpace.size;
|
||||
}
|
||||
|
|
|
@ -21,27 +21,27 @@ class ClassAllocationProfileElement extends CustomElement
|
|||
CpuProfileVirtualTreeElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ClassAllocationProfileElement> _r;
|
||||
RenderingScheduler<ClassAllocationProfileElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ClassAllocationProfileElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.Class _cls;
|
||||
late M.ClassSampleProfileRepository _profiles;
|
||||
late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress? _progress;
|
||||
late M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
late ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.Class _cls;
|
||||
M.ClassSampleProfileRepository _profiles;
|
||||
Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress _progress;
|
||||
M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.Class get cls => _cls;
|
||||
|
||||
factory ClassAllocationProfileElement(M.VM vm, M.IsolateRef isolate,
|
||||
M.Class cls, M.ClassSampleProfileRepository profiles,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(cls != null);
|
||||
|
@ -79,7 +79,7 @@ class ClassAllocationProfileElement extends CustomElement
|
|||
return;
|
||||
}
|
||||
final content = <HtmlElement>[
|
||||
(new SampleBufferControlElement(_vm, _progress!, _progressStream,
|
||||
(new SampleBufferControlElement(_vm, _progress, _progressStream,
|
||||
selectedTag: _tag, queue: _r.queue)
|
||||
..onTagChange.listen((e) {
|
||||
_tag = e.element.selectedTag;
|
||||
|
@ -87,8 +87,8 @@ class ClassAllocationProfileElement extends CustomElement
|
|||
}))
|
||||
.element
|
||||
];
|
||||
if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
late CpuProfileVirtualTreeElement tree;
|
||||
if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
CpuProfileVirtualTreeElement tree;
|
||||
content.addAll([
|
||||
new BRElement(),
|
||||
(new StackTraceTreeConfigElement(
|
||||
|
@ -104,7 +104,7 @@ class ClassAllocationProfileElement extends CustomElement
|
|||
}))
|
||||
.element,
|
||||
new BRElement(),
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
|
||||
queue: _r.queue))
|
||||
.element
|
||||
]);
|
||||
|
@ -119,7 +119,7 @@ class ClassAllocationProfileElement extends CustomElement
|
|||
_r.dirty();
|
||||
_progress = (await _progressStream.first).progress;
|
||||
_r.dirty();
|
||||
if (M.isSampleProcessRunning(_progress!.status)) {
|
||||
if (M.isSampleProcessRunning(_progress.status)) {
|
||||
_progress = (await _progressStream.last).progress;
|
||||
_r.dirty();
|
||||
}
|
||||
|
|
|
@ -22,19 +22,19 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
RetainingPathElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ClassInstancesElement> _r;
|
||||
RenderingScheduler<ClassInstancesElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ClassInstancesElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.Class _cls;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
|
||||
late M.ObjectRepository _objects;
|
||||
M.Guarded<M.Instance>? _retainedSize = null;
|
||||
M.IsolateRef _isolate;
|
||||
M.Class _cls;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.StronglyReachableInstancesRepository _stronglyReachableInstances;
|
||||
M.ObjectRepository _objects;
|
||||
M.Guarded<M.Instance> _retainedSize = null;
|
||||
bool _loadingRetainedBytes = false;
|
||||
M.Guarded<M.Instance>? _reachableSize = null;
|
||||
M.Guarded<M.Instance> _reachableSize = null;
|
||||
bool _loadingReachableBytes = false;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -47,7 +47,7 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
M.ReachableSizeRepository reachableSizes,
|
||||
M.StronglyReachableInstancesRepository stronglyReachableInstances,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(cls != null);
|
||||
assert(retainedSizes != null);
|
||||
|
@ -80,15 +80,15 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
StronglyReachableInstancesElement? _strong;
|
||||
StronglyReachableInstancesElement _strong;
|
||||
|
||||
void render() {
|
||||
_strong = _strong ??
|
||||
new StronglyReachableInstancesElement(
|
||||
_isolate, _cls, _stronglyReachableInstances, _objects,
|
||||
queue: _r.queue);
|
||||
final instanceCount = _cls.newSpace!.instances + _cls.oldSpace!.instances;
|
||||
final size = Utils.formatSize(_cls.newSpace!.size + _cls.oldSpace!.size);
|
||||
final instanceCount = _cls.newSpace.instances + _cls.oldSpace.instances;
|
||||
final size = Utils.formatSize(_cls.newSpace.size + _cls.oldSpace.size);
|
||||
children = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
|
@ -111,7 +111,7 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
..text = 'strongly reachable ',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[_strong!.element]
|
||||
..children = <Element>[_strong.element]
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -144,14 +144,14 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
List<Element> _createReachableSizeValue() {
|
||||
final content = <Element>[];
|
||||
if (_reachableSize != null) {
|
||||
if (_reachableSize!.isSentinel) {
|
||||
content.add(new SentinelValueElement(_reachableSize!.asSentinel!,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
if (_reachableSize.isSentinel) {
|
||||
content.add(
|
||||
new SentinelValueElement(_reachableSize.asSentinel, queue: _r.queue)
|
||||
.element);
|
||||
} else {
|
||||
content.add(new SpanElement()
|
||||
..text = Utils.formatSize(
|
||||
int.parse(_reachableSize!.asValue!.valueAsString!)));
|
||||
int.parse(_reachableSize.asValue.valueAsString)));
|
||||
}
|
||||
} else {
|
||||
content.add(new SpanElement()..text = '...');
|
||||
|
@ -163,7 +163,7 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
button.onClick.listen((_) async {
|
||||
button.disabled = true;
|
||||
_loadingReachableBytes = true;
|
||||
_reachableSize = await _reachableSizes.get(_isolate, _cls.id!);
|
||||
_reachableSize = await _reachableSizes.get(_isolate, _cls.id);
|
||||
_r.dirty();
|
||||
});
|
||||
content.add(button);
|
||||
|
@ -173,14 +173,14 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
List<Element> _createRetainedSizeValue() {
|
||||
final content = <Element>[];
|
||||
if (_retainedSize != null) {
|
||||
if (_retainedSize!.isSentinel) {
|
||||
content.add(new SentinelValueElement(_retainedSize!.asSentinel!,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
if (_retainedSize.isSentinel) {
|
||||
content.add(
|
||||
new SentinelValueElement(_retainedSize.asSentinel, queue: _r.queue)
|
||||
.element);
|
||||
} else {
|
||||
content.add(new SpanElement()
|
||||
..text = Utils.formatSize(
|
||||
int.parse(_retainedSize!.asValue!.valueAsString!)));
|
||||
..text =
|
||||
Utils.formatSize(int.parse(_retainedSize.asValue.valueAsString)));
|
||||
}
|
||||
} else {
|
||||
content.add(new SpanElement()..text = '...');
|
||||
|
@ -192,7 +192,7 @@ class ClassInstancesElement extends CustomElement implements Renderable {
|
|||
button.onClick.listen((_) async {
|
||||
button.disabled = true;
|
||||
_loadingRetainedBytes = true;
|
||||
_retainedSize = await _retainedSizes.get(_isolate, _cls.id!);
|
||||
_retainedSize = await _retainedSizes.get(_isolate, _cls.id);
|
||||
_r.dirty();
|
||||
});
|
||||
content.add(button);
|
||||
|
|
|
@ -12,18 +12,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class ClassRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<ClassRefElement>('class-ref');
|
||||
|
||||
late RenderingScheduler<ClassRefElement> _r;
|
||||
RenderingScheduler<ClassRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ClassRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ClassRef _class;
|
||||
M.IsolateRef _isolate;
|
||||
M.ClassRef _class;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.ClassRef get cls => _class;
|
||||
|
||||
factory ClassRefElement(M.IsolateRef isolate, M.ClassRef cls,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(cls != null);
|
||||
ClassRefElement e = new ClassRefElement.created();
|
||||
e._r = new RenderingScheduler<ClassRefElement>(e, queue: queue);
|
||||
|
|
|
@ -29,26 +29,26 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
VirtualTreeElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ClassTreeElement> _r;
|
||||
RenderingScheduler<ClassTreeElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ClassTreeElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.ClassRepository _classes;
|
||||
M.Class? _object;
|
||||
M.VMRef _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.ClassRepository _classes;
|
||||
M.Class _object;
|
||||
final _subclasses = <String, Iterable<M.Class>>{};
|
||||
final _mixins = <String, List<M.Instance>?>{};
|
||||
final _mixins = <String, List<M.Instance>>{};
|
||||
|
||||
factory ClassTreeElement(
|
||||
M.VM vm,
|
||||
M.VMRef vm,
|
||||
M.IsolateRef isolate,
|
||||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.ClassRepository classes,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -80,7 +80,7 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
_r.disable(notify: true);
|
||||
}
|
||||
|
||||
VirtualTreeElement? _tree;
|
||||
VirtualTreeElement _tree;
|
||||
|
||||
void render() {
|
||||
children = <Element>[
|
||||
|
@ -108,8 +108,8 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
Element _createTree() {
|
||||
_tree = new VirtualTreeElement(_create, _update, _children,
|
||||
items: [_object], search: _search, queue: _r.queue);
|
||||
_tree!.expand(_object, autoExpandSingleChildNodes: true);
|
||||
return _tree!.element;
|
||||
_tree.expand(_object, autoExpandSingleChildNodes: true);
|
||||
return _tree.element;
|
||||
}
|
||||
|
||||
Future _refresh() async {
|
||||
|
@ -121,26 +121,25 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future<M.Class> _register(M.Class cls) async {
|
||||
_subclasses[cls.id!] = await Future.wait(
|
||||
(await Future.wait(cls.subclasses!.map(_getActualChildrens)))
|
||||
_subclasses[cls.id] = await Future.wait(
|
||||
(await Future.wait(cls.subclasses.map(_getActualChildrens)))
|
||||
.expand((f) => f)
|
||||
.map(_register));
|
||||
return cls;
|
||||
}
|
||||
|
||||
Future<Iterable<M.Class>> _getActualChildrens(M.ClassRef ref) async {
|
||||
var cls = await _classes.get(_isolate, ref.id!);
|
||||
if (cls.isPatch!) {
|
||||
var cls = await _classes.get(_isolate, ref.id);
|
||||
if (cls.isPatch) {
|
||||
return const [];
|
||||
}
|
||||
if (cls.mixin == null) {
|
||||
return [cls];
|
||||
}
|
||||
return (await Future.wait(cls.subclasses!.map(_getActualChildrens)))
|
||||
return (await Future.wait(cls.subclasses.map(_getActualChildrens)))
|
||||
.expand((f) => f)
|
||||
..forEach((subcls) {
|
||||
_mixins[subcls.id!] = (_mixins[subcls.id!] ?? [])
|
||||
..add(cls.mixin as M.Instance);
|
||||
_mixins[subcls.id] = (_mixins[subcls.id] ?? [])..add(cls.mixin);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -158,23 +157,23 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
|
||||
void _update(HtmlElement el, classDynamic, int index) {
|
||||
M.Class cls = classDynamic;
|
||||
virtualTreeUpdateLines(el.children[0] as SpanElement, index);
|
||||
if (cls.subclasses!.isEmpty) {
|
||||
virtualTreeUpdateLines(el.children[0], index);
|
||||
if (cls.subclasses.isEmpty) {
|
||||
el.children[1].text = '';
|
||||
} else {
|
||||
el.children[1].text = _tree!.isExpanded(cls) ? '▼' : '►';
|
||||
el.children[1].text = _tree.isExpanded(cls) ? '▼' : '►';
|
||||
}
|
||||
el.children[2].children = <Element>[
|
||||
new ClassRefElement(_isolate, cls, queue: _r.queue).element
|
||||
];
|
||||
if (_mixins[cls.id] != null) {
|
||||
el.children[2].children.addAll(_createMixins(_mixins[cls.id]!));
|
||||
el.children[2].children.addAll(_createMixins(_mixins[cls.id]));
|
||||
}
|
||||
}
|
||||
|
||||
bool _search(Pattern pattern, classDynamic) {
|
||||
M.Class cls = classDynamic;
|
||||
return cls.name!.contains(pattern);
|
||||
return cls.name.contains(pattern);
|
||||
}
|
||||
|
||||
List<Element> _createMixins(List<M.Instance> types) {
|
||||
|
@ -182,8 +181,8 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
.expand((type) => <Element>[
|
||||
new SpanElement()..text = ', ',
|
||||
type.typeClass == null
|
||||
? (new SpanElement()..text = type.name!.split('<').first)
|
||||
: new ClassRefElement(_isolate, type.typeClass!,
|
||||
? (new SpanElement()..text = type.name.split('<').first)
|
||||
: new ClassRefElement(_isolate, type.typeClass,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
])
|
||||
|
@ -194,6 +193,6 @@ class ClassTreeElement extends CustomElement implements Renderable {
|
|||
|
||||
Iterable<M.Class> _children(classDynamic) {
|
||||
M.Class cls = classDynamic;
|
||||
return _subclasses[cls.id]!;
|
||||
return _subclasses[cls.id];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,27 +56,27 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ClassViewElement> _r;
|
||||
RenderingScheduler<ClassViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ClassViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Class _cls;
|
||||
late M.ClassRepository _classes;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
|
||||
late M.FieldRepository _fields;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.EvalRepository _eval;
|
||||
late M.ClassSampleProfileRepository _profiles;
|
||||
Iterable<M.Field>? _classFields;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Class _cls;
|
||||
M.ClassRepository _classes;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.StronglyReachableInstancesRepository _stronglyReachableInstances;
|
||||
M.FieldRepository _fields;
|
||||
M.ScriptRepository _scripts;
|
||||
M.ObjectRepository _objects;
|
||||
M.EvalRepository _eval;
|
||||
M.ClassSampleProfileRepository _profiles;
|
||||
Iterable<M.Field> _classFields;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -100,7 +100,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
M.EvalRepository eval,
|
||||
M.StronglyReachableInstancesRepository stronglyReachable,
|
||||
M.ClassSampleProfileRepository profiles,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -154,8 +154,8 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
ObjectCommonElement? _common;
|
||||
ClassInstancesElement? _classInstances;
|
||||
ObjectCommonElement _common;
|
||||
ClassInstancesElement _classInstances;
|
||||
bool _loadProfile = false;
|
||||
|
||||
void render() {
|
||||
|
@ -168,10 +168,10 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
_reachableSizes, _stronglyReachableInstances, _objects,
|
||||
queue: _r.queue);
|
||||
var header = '';
|
||||
if (_cls.isAbstract!) {
|
||||
if (_cls.isAbstract) {
|
||||
header += 'abstract ';
|
||||
}
|
||||
if (_cls.isPatch!) {
|
||||
if (_cls.isPatch) {
|
||||
header += 'patch ';
|
||||
}
|
||||
children = <Element>[
|
||||
|
@ -205,7 +205,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
new HeadingElement.h2()..text = '$header class ${_cls.name}',
|
||||
new HRElement(),
|
||||
_common!.element,
|
||||
_common.element,
|
||||
new BRElement(),
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
|
@ -215,7 +215,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
? const []
|
||||
: [
|
||||
new HRElement(),
|
||||
new ErrorRefElement(_cls.error!, queue: _r.queue).element
|
||||
new ErrorRefElement(_cls.error, queue: _r.queue).element
|
||||
],
|
||||
new HRElement(),
|
||||
new EvalBoxElement(_isolate, _cls, _objects, _eval, queue: _r.queue)
|
||||
|
@ -227,7 +227,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..children = _createElements(),
|
||||
new HRElement(),
|
||||
new HeadingElement.h2()..text = 'Instances',
|
||||
new DivElement()..children = [_classInstances!.element],
|
||||
new DivElement()..children = [_classInstances.element],
|
||||
new HRElement(),
|
||||
new HeadingElement.h2()..text = 'Allocations',
|
||||
new DivElement()
|
||||
|
@ -238,7 +238,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..text = 'Tracing allocations? ',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = _cls.traceAllocations!
|
||||
..children = _cls.traceAllocations
|
||||
? [
|
||||
new SpanElement()..text = 'Yes ',
|
||||
new ButtonElement()
|
||||
|
@ -274,7 +274,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..children = _cls.location != null
|
||||
? [
|
||||
new HRElement(),
|
||||
new SourceInsetElement(_isolate, _cls.location!, _scripts,
|
||||
new SourceInsetElement(_isolate, _cls.location, _scripts,
|
||||
_objects, _events,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
|
@ -286,8 +286,8 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
];
|
||||
}
|
||||
|
||||
bool? _fieldsExpanded;
|
||||
bool? _functionsExpanded;
|
||||
bool _fieldsExpanded;
|
||||
bool _functionsExpanded;
|
||||
|
||||
List<Element> _createMembers() {
|
||||
final members = <Element>[];
|
||||
|
@ -301,7 +301,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new LibraryRefElement(_isolate, _cls.library!, queue: _r.queue)
|
||||
new LibraryRefElement(_isolate, _cls.library, queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]);
|
||||
|
@ -316,7 +316,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new SourceLinkElement(_isolate, _cls.location!, _scripts,
|
||||
new SourceLinkElement(_isolate, _cls.location, _scripts,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -332,7 +332,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new ClassRefElement(_isolate, _cls.superclass!, queue: _r.queue)
|
||||
new ClassRefElement(_isolate, _cls.superclass, queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]);
|
||||
|
@ -347,7 +347,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new InstanceRefElement(_isolate, _cls.superType!, _objects,
|
||||
new InstanceRefElement(_isolate, _cls.superType, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -363,13 +363,13 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new InstanceRefElement(_isolate, _cls.mixin!, _objects,
|
||||
new InstanceRefElement(_isolate, _cls.mixin, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]);
|
||||
}
|
||||
if (_cls.subclasses!.length > 0) {
|
||||
if (_cls.subclasses.length > 0) {
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -378,7 +378,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..text = 'extended by',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = (_cls.subclasses!
|
||||
..children = (_cls.subclasses
|
||||
.expand((subcls) => <Element>[
|
||||
new ClassRefElement(_isolate, subcls, queue: _r.queue)
|
||||
.element,
|
||||
|
@ -391,7 +391,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
|
||||
members.add(new BRElement());
|
||||
|
||||
if (_cls.interfaces!.length > 0) {
|
||||
if (_cls.interfaces.length > 0) {
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -400,7 +400,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
..text = 'implements',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = (_cls.interfaces!
|
||||
..children = (_cls.interfaces
|
||||
.expand((interf) => <Element>[
|
||||
new InstanceRefElement(_isolate, interf, _objects,
|
||||
queue: _r.queue)
|
||||
|
@ -428,8 +428,8 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
|
||||
List<Element> _createElements() {
|
||||
final members = <Element>[];
|
||||
if (_classFields != null && _classFields!.isNotEmpty) {
|
||||
final fields = _classFields!.toList();
|
||||
if (_classFields != null && _classFields.isNotEmpty) {
|
||||
final fields = _classFields.toList();
|
||||
_fieldsExpanded = _fieldsExpanded ?? (fields.length <= 8);
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -440,7 +440,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
(new CurlyBlockElement(expanded: _fieldsExpanded!)
|
||||
(new CurlyBlockElement(expanded: _fieldsExpanded)
|
||||
..onToggle
|
||||
.listen((e) => _fieldsExpanded = e.control.expanded)
|
||||
..content = <Element>[
|
||||
|
@ -474,8 +474,8 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
}
|
||||
|
||||
if (_cls.functions!.isNotEmpty) {
|
||||
final functions = _cls.functions!.toList();
|
||||
if (_cls.functions.isNotEmpty) {
|
||||
final functions = _cls.functions.toList();
|
||||
_functionsExpanded = _functionsExpanded ?? (functions.length <= 8);
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -486,7 +486,7 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
(new CurlyBlockElement(expanded: _functionsExpanded!)
|
||||
(new CurlyBlockElement(expanded: _functionsExpanded)
|
||||
..onToggle
|
||||
.listen((e) => _functionsExpanded = e.control.expanded)
|
||||
..content = (functions
|
||||
|
@ -505,14 +505,14 @@ class ClassViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_cls = await _classes.get(_isolate, _cls.id!);
|
||||
_cls = await _classes.get(_isolate, _cls.id);
|
||||
await _loadAdditionalData();
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
Future _loadAdditionalData() async {
|
||||
_classFields = await Future.wait(
|
||||
_cls.fields!.map((f) => _fields.get(_isolate, f.id!)));
|
||||
_classFields =
|
||||
await Future.wait(_cls.fields.map((f) => _fields.get(_isolate, f.id)));
|
||||
_r.dirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class CodeRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<CodeRefElement>('code-ref');
|
||||
|
||||
late RenderingScheduler<CodeRefElement> _r;
|
||||
RenderingScheduler<CodeRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<CodeRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
M.IsolateRef? _isolate;
|
||||
late M.CodeRef _code;
|
||||
M.IsolateRef _isolate;
|
||||
M.CodeRef _code;
|
||||
|
||||
M.IsolateRef get isolate => _isolate!;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.CodeRef get code => _code;
|
||||
|
||||
factory CodeRefElement(M.IsolateRef? isolate, M.CodeRef code,
|
||||
{RenderingQueue? queue}) {
|
||||
factory CodeRefElement(M.IsolateRef isolate, M.CodeRef code,
|
||||
{RenderingQueue queue}) {
|
||||
assert(code != null);
|
||||
CodeRefElement e = new CodeRefElement.created();
|
||||
e._r = new RenderingScheduler<CodeRefElement>(e, queue: queue);
|
||||
|
@ -55,7 +55,7 @@ class CodeRefElement extends CustomElement implements Renderable {
|
|||
new AnchorElement(
|
||||
href: ((M.isSyntheticCode(_code.kind)) || (_isolate == null))
|
||||
? null
|
||||
: Uris.inspect(_isolate!, object: _code))
|
||||
: Uris.inspect(_isolate, object: _code))
|
||||
..text = _code.name
|
||||
];
|
||||
}
|
||||
|
|
|
@ -51,22 +51,22 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
ObjectPoolRefElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<CodeViewElement> _r;
|
||||
RenderingScheduler<CodeViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<CodeViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Code _code;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
late DisassemblyTable disassemblyTable;
|
||||
late InlineTable inlineTable;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Code _code;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
DisassemblyTable disassemblyTable;
|
||||
InlineTable inlineTable;
|
||||
|
||||
static const kDisassemblyColumnIndex = 3;
|
||||
|
||||
|
@ -86,7 +86,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -143,15 +143,15 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
TableElement? _disassemblyTable;
|
||||
TableElement? _inlineRangeTable;
|
||||
Element? _disassemblyTableBody;
|
||||
Element? _inlineRangeTableBody;
|
||||
TableElement _disassemblyTable;
|
||||
TableElement _inlineRangeTable;
|
||||
Element _disassemblyTableBody;
|
||||
Element _inlineRangeTableBody;
|
||||
|
||||
void render() {
|
||||
if (_inlineRangeTable == null) {
|
||||
_inlineRangeTable = new TableElement()..classes = ['table'];
|
||||
_inlineRangeTable!.createTHead().children = <Element>[
|
||||
_inlineRangeTable.createTHead().children = <Element>[
|
||||
new TableRowElement()
|
||||
..children = <Element>[
|
||||
document.createElement('th')
|
||||
|
@ -166,12 +166,12 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
document.createElement('th')..text = 'Functions',
|
||||
]
|
||||
];
|
||||
_inlineRangeTableBody = _inlineRangeTable!.createTBody();
|
||||
_inlineRangeTableBody!.classes = ['monospace'];
|
||||
_inlineRangeTableBody = _inlineRangeTable.createTBody();
|
||||
_inlineRangeTableBody.classes = ['monospace'];
|
||||
}
|
||||
if (_disassemblyTable == null) {
|
||||
_disassemblyTable = new TableElement()..classes = ['table'];
|
||||
_disassemblyTable!.createTHead().children = <Element>[
|
||||
_disassemblyTable.createTHead().children = <Element>[
|
||||
new TableRowElement()
|
||||
..children = <Element>[
|
||||
document.createElement('th')
|
||||
|
@ -193,17 +193,17 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
..text = 'Object',
|
||||
]
|
||||
];
|
||||
_disassemblyTableBody = _disassemblyTable!.createTBody();
|
||||
_disassemblyTableBody!.classes = ['monospace'];
|
||||
_disassemblyTableBody = _disassemblyTable.createTBody();
|
||||
_disassemblyTableBody.classes = ['monospace'];
|
||||
}
|
||||
final inlinedFunctions = _code.inlinedFunctions!.toList();
|
||||
final inlinedFunctions = _code.inlinedFunctions.toList();
|
||||
final S.Code code = _code as S.Code;
|
||||
children = <Element>[
|
||||
navBar(<Element>[
|
||||
new NavTopMenuElement(queue: _r.queue).element,
|
||||
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
|
||||
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element,
|
||||
navMenu(_code.name!),
|
||||
navMenu(_code.name),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
|
@ -222,7 +222,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
..classes = ['content-centered-big']
|
||||
..children = <Element>[
|
||||
new HeadingElement.h1()
|
||||
..text = (M.isDartCode(_code.kind) && _code.isOptimized!)
|
||||
..text = (M.isDartCode(_code.kind) && _code.isOptimized)
|
||||
? 'Optimized code for ${_code.name}'
|
||||
: 'Code for ${_code.name}',
|
||||
new HRElement(),
|
||||
|
@ -254,7 +254,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
..text = 'Optimized',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..text = _code.isOptimized! ? 'Yes' : 'No'
|
||||
..text = _code.isOptimized ? 'Yes' : 'No'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -265,7 +265,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new FunctionRefElement(_isolate, _code.function!,
|
||||
new FunctionRefElement(_isolate, _code.function,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -280,7 +280,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
..text = 'Inclusive',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..text = '${code.profile!.formattedInclusiveTicks}'
|
||||
..text = '${code.profile.formattedInclusiveTicks}'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -292,7 +292,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
..text = 'Exclusive',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..text = '${code.profile!.formattedExclusiveTicks}'
|
||||
..text = '${code.profile.formattedExclusiveTicks}'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -303,7 +303,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new ObjectPoolRefElement(_isolate, _code.objectPool!,
|
||||
new ObjectPoolRefElement(_isolate, _code.objectPool,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -334,9 +334,9 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
]
|
||||
],
|
||||
new HRElement(),
|
||||
_inlineRangeTable!,
|
||||
_inlineRangeTable,
|
||||
new HRElement(),
|
||||
_disassemblyTable!
|
||||
_disassemblyTable
|
||||
],
|
||||
];
|
||||
_updateDisassembly();
|
||||
|
@ -351,10 +351,11 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
|
||||
Future _refreshTicks() async {
|
||||
S.Code code = _code as S.Code;
|
||||
final isolate = code.isolate!;
|
||||
var response = await isolate.invokeRpc('_getCpuProfile', {'tags': 'None'});
|
||||
final isolate = code.isolate;
|
||||
S.ServiceMap response =
|
||||
await isolate.invokeRpc('_getCpuProfile', {'tags': 'None'});
|
||||
final cpuProfile = new SampleProfile();
|
||||
await cpuProfile.load(isolate, response as S.ServiceMap);
|
||||
await cpuProfile.load(isolate, response);
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
|
@ -376,7 +377,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
if (code.profile == null) {
|
||||
return '';
|
||||
}
|
||||
var intervalTick = code.profile!.intervalTicks[interval.start];
|
||||
var intervalTick = code.profile.intervalTicks[interval.start];
|
||||
if (intervalTick == null) {
|
||||
return '';
|
||||
}
|
||||
|
@ -385,7 +386,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
return '';
|
||||
}
|
||||
var pcent = Utils.formatPercent(
|
||||
intervalTick.inclusiveTicks, code.profile!.profile.sampleCount);
|
||||
intervalTick.inclusiveTicks, code.profile.profile.sampleCount);
|
||||
return '$pcent (${intervalTick.inclusiveTicks})';
|
||||
}
|
||||
|
||||
|
@ -394,22 +395,21 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
if (code.profile == null) {
|
||||
return '';
|
||||
}
|
||||
var intervalTick = code.profile!.intervalTicks[interval.start];
|
||||
var intervalTick = code.profile.intervalTicks[interval.start];
|
||||
if (intervalTick == null) {
|
||||
return '';
|
||||
}
|
||||
var pcent = Utils.formatPercent(
|
||||
intervalTick.exclusiveTicks, code.profile!.profile.sampleCount);
|
||||
intervalTick.exclusiveTicks, code.profile.profile.sampleCount);
|
||||
return '$pcent (${intervalTick.exclusiveTicks})';
|
||||
}
|
||||
|
||||
String _formattedInclusive(S.CodeInstruction instruction) {
|
||||
S.Code code = _code as S.Code;
|
||||
var profile = code.profile;
|
||||
if (profile == null) {
|
||||
if (code.profile == null) {
|
||||
return '';
|
||||
}
|
||||
var tick = profile.addressTicks[instruction.address];
|
||||
var tick = code.profile.addressTicks[instruction.address];
|
||||
if (tick == null) {
|
||||
return '';
|
||||
}
|
||||
|
@ -417,23 +417,22 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
if (tick.inclusiveTicks == tick.exclusiveTicks) {
|
||||
return '';
|
||||
}
|
||||
var pcent =
|
||||
Utils.formatPercent(tick.inclusiveTicks, profile.profile.sampleCount);
|
||||
var pcent = Utils.formatPercent(
|
||||
tick.inclusiveTicks, code.profile.profile.sampleCount);
|
||||
return '$pcent (${tick.inclusiveTicks})';
|
||||
}
|
||||
|
||||
String _formattedExclusive(S.CodeInstruction instruction) {
|
||||
S.Code code = _code as S.Code;
|
||||
var profile = code.profile;
|
||||
if (profile == null) {
|
||||
if (code.profile == null) {
|
||||
return '';
|
||||
}
|
||||
var tick = profile.addressTicks[instruction.address];
|
||||
var tick = code.profile.addressTicks[instruction.address];
|
||||
if (tick == null) {
|
||||
return '';
|
||||
}
|
||||
var pcent =
|
||||
Utils.formatPercent(tick.exclusiveTicks, profile.profile.sampleCount);
|
||||
var pcent = Utils.formatPercent(
|
||||
tick.exclusiveTicks, code.profile.profile.sampleCount);
|
||||
return '$pcent (${tick.exclusiveTicks})';
|
||||
}
|
||||
|
||||
|
@ -456,7 +455,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void _addDisassemblyDOMRow() {
|
||||
var tableBody = _disassemblyTableBody!;
|
||||
var tableBody = _disassemblyTableBody;
|
||||
assert(tableBody != null);
|
||||
var tr = new TableRowElement();
|
||||
|
||||
|
@ -507,7 +506,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void _updateDisassemblyDOMTable() {
|
||||
var tableBody = _disassemblyTableBody!;
|
||||
var tableBody = _disassemblyTableBody;
|
||||
assert(tableBody != null);
|
||||
// Resize DOM table.
|
||||
if (tableBody.children.length > disassemblyTable.sortedRows.length) {
|
||||
|
@ -532,7 +531,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
var i = 0;
|
||||
for (var tr in tableBody.children) {
|
||||
var rowIndex = disassemblyTable.sortedRows[i];
|
||||
_fillDisassemblyDOMRow(tr as TableRowElement, rowIndex);
|
||||
_fillDisassemblyDOMRow(tr, rowIndex);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +556,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void _addInlineDOMRow() {
|
||||
var tableBody = _inlineRangeTableBody!;
|
||||
var tableBody = _inlineRangeTableBody;
|
||||
assert(tableBody != null);
|
||||
var tr = new TableRowElement();
|
||||
|
||||
|
@ -610,7 +609,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void _updateInlineDOMTable() {
|
||||
var tableBody = _inlineRangeTableBody!;
|
||||
var tableBody = _inlineRangeTableBody;
|
||||
// Resize DOM table.
|
||||
if (tableBody.children.length > inlineTable.sortedRows.length) {
|
||||
// Shrink the table.
|
||||
|
@ -630,7 +629,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
for (var i = 0; i < inlineTable.sortedRows.length; i++) {
|
||||
var rowIndex = inlineTable.sortedRows[i];
|
||||
var tr = tableBody.children[i];
|
||||
_fillInlineDOMRow(tr as TableRowElement, rowIndex);
|
||||
_fillInlineDOMRow(tr, rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -639,7 +638,7 @@ class CodeViewElement extends CustomElement implements Renderable {
|
|||
_updateInlineDOMTable();
|
||||
}
|
||||
|
||||
static String _codeKindToString(M.CodeKind? kind) {
|
||||
static String _codeKindToString(M.CodeKind kind) {
|
||||
switch (kind) {
|
||||
case M.CodeKind.dart:
|
||||
return 'dart';
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef Iterable<dynamic> SearchBarSearchCallback(Pattern pattern);
|
|||
class SearchBarElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<SearchBarElement>('search-bar');
|
||||
|
||||
late RenderingScheduler<SearchBarElement> _r;
|
||||
RenderingScheduler<SearchBarElement> _r;
|
||||
|
||||
StreamController<SearchResultSelected> _onSearchResultSelected =
|
||||
new StreamController<SearchResultSelected>.broadcast();
|
||||
|
@ -28,11 +28,11 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
Stream<SearchResultSelected> get onSearchResultSelected =>
|
||||
_onSearchResultSelected.stream;
|
||||
|
||||
late StreamSubscription _onKeyDownSubscription;
|
||||
StreamSubscription _onKeyDownSubscription;
|
||||
|
||||
Element? _workspace;
|
||||
late SearchBarSearchCallback _search;
|
||||
late bool _isOpen;
|
||||
Element _workspace;
|
||||
SearchBarSearchCallback _search;
|
||||
bool _isOpen;
|
||||
bool _focusRequested = false;
|
||||
String _lastValue = '';
|
||||
List _results = const [];
|
||||
|
@ -43,7 +43,7 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
|
||||
set isOpen(bool value) {
|
||||
if (!value) {
|
||||
_input!.value = '';
|
||||
_input.value = '';
|
||||
_lastValue = '';
|
||||
if (_results.isNotEmpty) {
|
||||
_results = const [];
|
||||
|
@ -55,7 +55,7 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory SearchBarElement(SearchBarSearchCallback search,
|
||||
{bool isOpen: false, Element? workspace, RenderingQueue? queue}) {
|
||||
{bool isOpen: false, Element workspace, RenderingQueue queue}) {
|
||||
assert(search != null);
|
||||
assert(isOpen != null);
|
||||
SearchBarElement e = new SearchBarElement.created();
|
||||
|
@ -96,15 +96,15 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
_onKeyDownSubscription.cancel();
|
||||
}
|
||||
|
||||
TextInputElement? _input;
|
||||
SpanElement? _resultsArea;
|
||||
TextInputElement _input;
|
||||
SpanElement _resultsArea;
|
||||
|
||||
void render() {
|
||||
if (_input == null) {
|
||||
_input = new TextInputElement()
|
||||
..onKeyPress.listen((e) {
|
||||
if (e.keyCode == KeyCode.ENTER) {
|
||||
if (_input!.value == '') {
|
||||
if (_input.value == '') {
|
||||
_lastValue = '';
|
||||
if (_results.isNotEmpty) {
|
||||
_results = const [];
|
||||
|
@ -112,9 +112,9 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
_triggerSearchResultSelected();
|
||||
_r.dirty();
|
||||
}
|
||||
} else if (_input!.value != _lastValue) {
|
||||
_lastValue = _input!.value;
|
||||
_results = _doSearch(_input!.value);
|
||||
} else if (_input.value != _lastValue) {
|
||||
_lastValue = _input.value;
|
||||
_results = _doSearch(_input.value);
|
||||
_current = 0;
|
||||
_triggerSearchResultSelected();
|
||||
_r.dirty();
|
||||
|
@ -129,8 +129,8 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
});
|
||||
_resultsArea = new SpanElement();
|
||||
children = <Element>[
|
||||
_input!,
|
||||
_resultsArea!,
|
||||
_input,
|
||||
_resultsArea,
|
||||
new ButtonElement()
|
||||
..text = '❌'
|
||||
..onClick.listen((_) {
|
||||
|
@ -138,7 +138,7 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
})
|
||||
];
|
||||
}
|
||||
_resultsArea!.nodes = [
|
||||
_resultsArea.nodes = [
|
||||
new ButtonElement()
|
||||
..text = '▲'
|
||||
..disabled = _results.isEmpty
|
||||
|
@ -152,7 +152,7 @@ class SearchBarElement extends CustomElement implements Renderable {
|
|||
];
|
||||
style.visibility = isOpen ? null : 'collapse';
|
||||
if (_focusRequested) {
|
||||
_input!.focus();
|
||||
_input.focus();
|
||||
_focusRequested = false;
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,6 @@ class _CaseInsensitivePatternString implements Pattern {
|
|||
Iterable<Match> allMatches(String string, [int start = 0]) =>
|
||||
_pattern.allMatches(string.toLowerCase(), start);
|
||||
|
||||
Match? matchAsPrefix(String string, [int start = 0]) =>
|
||||
Match matchAsPrefix(String string, [int start = 0]) =>
|
||||
_pattern.matchAsPrefix(string.toLowerCase(), start);
|
||||
}
|
||||
|
|
|
@ -19,23 +19,23 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<VirtualCollectionElement>('virtual-collection',
|
||||
dependencies: const [SearchBarElement.tag]);
|
||||
|
||||
late RenderingScheduler<VirtualCollectionElement> _r;
|
||||
RenderingScheduler<VirtualCollectionElement> _r;
|
||||
|
||||
Stream<RenderedEvent<VirtualCollectionElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late VirtualCollectionCreateCallback _create;
|
||||
VirtualCollectionHeaderCallback? _createHeader;
|
||||
late VirtualCollectionUpdateCallback _update;
|
||||
VirtualCollectionSearchCallback? _search;
|
||||
double? _itemHeight;
|
||||
int? _top;
|
||||
double? _height;
|
||||
List? _items;
|
||||
late StreamSubscription _onScrollSubscription;
|
||||
late StreamSubscription _onResizeSubscription;
|
||||
VirtualCollectionCreateCallback _create;
|
||||
VirtualCollectionHeaderCallback _createHeader;
|
||||
VirtualCollectionUpdateCallback _update;
|
||||
VirtualCollectionSearchCallback _search;
|
||||
double _itemHeight;
|
||||
int _top;
|
||||
double _height;
|
||||
List _items;
|
||||
StreamSubscription _onScrollSubscription;
|
||||
StreamSubscription _onResizeSubscription;
|
||||
|
||||
List? get items => _items;
|
||||
List get items => _items;
|
||||
|
||||
set items(Iterable value) {
|
||||
_items = new List.unmodifiable(value);
|
||||
|
@ -47,9 +47,9 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
factory VirtualCollectionElement(VirtualCollectionCreateCallback create,
|
||||
VirtualCollectionUpdateCallback update,
|
||||
{Iterable items: const [],
|
||||
VirtualCollectionHeaderCallback? createHeader,
|
||||
VirtualCollectionSearchCallback? search,
|
||||
RenderingQueue? queue}) {
|
||||
VirtualCollectionHeaderCallback createHeader,
|
||||
VirtualCollectionSearchCallback search,
|
||||
RenderingQueue queue}) {
|
||||
assert(create != null);
|
||||
assert(update != null);
|
||||
assert(items != null);
|
||||
|
@ -84,8 +84,8 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
_onResizeSubscription.cancel();
|
||||
}
|
||||
|
||||
DivElement? _header;
|
||||
SearchBarElement? _searcher;
|
||||
DivElement _header;
|
||||
SearchBarElement _searcher;
|
||||
final DivElement _viewport = new DivElement()
|
||||
..classes = ['viewport', 'container'];
|
||||
final DivElement _spacer = new DivElement()..classes = ['spacer'];
|
||||
|
@ -106,11 +106,10 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
if (el_index < 0) {
|
||||
return null;
|
||||
}
|
||||
final item_index = _top! +
|
||||
el_index -
|
||||
safeFloor(_buffer.children.length * _inverse_preload);
|
||||
if (0 <= item_index && item_index < items!.length) {
|
||||
return _items![item_index];
|
||||
final item_index =
|
||||
_top + el_index - safeFloor(_buffer.children.length * _inverse_preload);
|
||||
if (0 <= item_index && item_index < items.length) {
|
||||
return _items[item_index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -152,39 +151,38 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
..onSearchResultSelected.listen((e) {
|
||||
takeIntoView(e.item);
|
||||
});
|
||||
children.insert(0, _searcher!.element);
|
||||
children.insert(0, _searcher.element);
|
||||
}
|
||||
if (_createHeader != null) {
|
||||
_header = new DivElement()
|
||||
..classes = ['header', 'container']
|
||||
..children = _createHeader!();
|
||||
children.insert(0, _header!);
|
||||
final rect = _header!.getBoundingClientRect();
|
||||
_header!.classes.add('attached');
|
||||
..children = _createHeader();
|
||||
children.insert(0, _header);
|
||||
final rect = _header.getBoundingClientRect();
|
||||
_header.classes.add('attached');
|
||||
_viewport.style.top = '${rect.height}px';
|
||||
final width = _header!.children.fold(0.0, _foldWidth);
|
||||
final width = _header.children.fold(0.0, _foldWidth);
|
||||
_buffer.style.minWidth = '${width}px';
|
||||
}
|
||||
_itemHeight =
|
||||
_buffer.children[0].getBoundingClientRect().height as double;
|
||||
_height = getBoundingClientRect().height as double;
|
||||
_itemHeight = _buffer.children[0].getBoundingClientRect().height;
|
||||
_height = getBoundingClientRect().height;
|
||||
}
|
||||
|
||||
if (_takeIntoView != null) {
|
||||
final index = items!.indexOf(_takeIntoView);
|
||||
final index = items.indexOf(_takeIntoView);
|
||||
if (index >= 0) {
|
||||
final minScrollTop = _itemHeight! * (index + 1) - _height!;
|
||||
final maxScrollTop = _itemHeight! * index;
|
||||
final minScrollTop = _itemHeight * (index + 1) - _height;
|
||||
final maxScrollTop = _itemHeight * index;
|
||||
_viewport.scrollTop =
|
||||
safeFloor((maxScrollTop - minScrollTop) / 2 + minScrollTop);
|
||||
}
|
||||
_takeIntoView = null;
|
||||
}
|
||||
|
||||
final top = safeFloor(_viewport.scrollTop / _itemHeight!);
|
||||
final top = safeFloor(_viewport.scrollTop / _itemHeight);
|
||||
|
||||
_spacer.style.height = '${_itemHeight! * (_items!.length)}px';
|
||||
final tail_length = safeCeil(_height! / _itemHeight! / _preload);
|
||||
_spacer.style.height = '${_itemHeight * (_items.length)}px';
|
||||
final tail_length = safeCeil(_height / _itemHeight / _preload);
|
||||
final length = tail_length * 2 + tail_length * _preload;
|
||||
|
||||
if (_buffer.children.length < length) {
|
||||
|
@ -196,13 +194,13 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
_top = null; // force update;
|
||||
}
|
||||
|
||||
if ((_top == null) || ((top - _top!).abs() >= tail_length)) {
|
||||
_buffer.style.top = '${_itemHeight! * (top - tail_length)}px';
|
||||
if ((_top == null) || ((top - _top).abs() >= tail_length)) {
|
||||
_buffer.style.top = '${_itemHeight * (top - tail_length)}px';
|
||||
int i = top - tail_length;
|
||||
for (final e in _buffer.children) {
|
||||
if (0 <= i && i < _items!.length) {
|
||||
for (final HtmlElement e in _buffer.children) {
|
||||
if (0 <= i && i < _items.length) {
|
||||
e.style.display = null;
|
||||
_update(e as HtmlElement, _items![i], i);
|
||||
_update(e, _items[i], i);
|
||||
} else {
|
||||
e.style.display = 'hidden';
|
||||
}
|
||||
|
@ -212,11 +210,11 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
if (_searcher != null) {
|
||||
final current = _searcher!.current;
|
||||
int i = _top! - tail_length;
|
||||
for (final e in _buffer.children) {
|
||||
if (0 <= i && i < _items!.length) {
|
||||
if (_items![i] == current) {
|
||||
final current = _searcher.current;
|
||||
int i = _top - tail_length;
|
||||
for (final HtmlElement e in _buffer.children) {
|
||||
if (0 <= i && i < _items.length) {
|
||||
if (_items[i] == current) {
|
||||
e.classes.add('marked');
|
||||
} else {
|
||||
e.classes.remove('marked');
|
||||
|
@ -229,14 +227,14 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
double _foldWidth(double value, Element child) {
|
||||
return math.max(value, child.getBoundingClientRect().width as double);
|
||||
return math.max(value, child.getBoundingClientRect().width);
|
||||
}
|
||||
|
||||
void _updateHeader() {
|
||||
if (_header != null) {
|
||||
_header!.style.left = '${-_viewport.scrollLeft}px';
|
||||
_header.style.left = '${-_viewport.scrollLeft}px';
|
||||
final width = _buffer.getBoundingClientRect().width;
|
||||
_header!.children.last.style.width = '${width}px';
|
||||
_header.children.last.style.width = '${width}px';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,8 +245,8 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void _onResize(_) {
|
||||
final newHeight = getBoundingClientRect().height as double;
|
||||
if (newHeight > _height!) {
|
||||
final newHeight = getBoundingClientRect().height;
|
||||
if (newHeight > _height) {
|
||||
_height = newHeight;
|
||||
_r.dirty();
|
||||
} else {
|
||||
|
@ -259,6 +257,6 @@ class VirtualCollectionElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Iterable<dynamic> _doSearch(Pattern search) {
|
||||
return _items!.where((item) => _search!(search, item));
|
||||
return _items.where((item) => _search(search, item));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ class VirtualTreeElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<VirtualTreeElement>('virtual-tree',
|
||||
dependencies: const [VirtualCollectionElement.tag]);
|
||||
|
||||
late RenderingScheduler<VirtualTreeElement> _r;
|
||||
RenderingScheduler<VirtualTreeElement> _r;
|
||||
|
||||
Stream<RenderedEvent<VirtualTreeElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late VritualTreeGetChildrenCallback _children;
|
||||
late List _items;
|
||||
late List _depths;
|
||||
VritualTreeGetChildrenCallback _children;
|
||||
List _items;
|
||||
List _depths;
|
||||
final Set _expanded = new Set();
|
||||
|
||||
List get items => _items;
|
||||
|
@ -50,8 +50,8 @@ class VirtualTreeElement extends CustomElement implements Renderable {
|
|||
factory VirtualTreeElement(VirtualTreeCreateCallback create,
|
||||
VirtualTreeUpdateCallback update, VritualTreeGetChildrenCallback children,
|
||||
{Iterable items: const [],
|
||||
VirtualTreeSearchCallback? search,
|
||||
RenderingQueue? queue}) {
|
||||
VirtualTreeSearchCallback search,
|
||||
RenderingQueue queue}) {
|
||||
assert(create != null);
|
||||
assert(update != null);
|
||||
assert(children != null);
|
||||
|
@ -64,7 +64,7 @@ class VirtualTreeElement extends CustomElement implements Renderable {
|
|||
return element = create((
|
||||
{bool autoToggleSingleChildNodes: false,
|
||||
bool autoToggleWholeTree: false}) {
|
||||
var item = e._collection!.getItemFromElement(element);
|
||||
var item = e._collection.getItemFromElement(element);
|
||||
if (e.isExpanded(item)) {
|
||||
e.collapse(item,
|
||||
autoCollapseWholeTree: autoToggleWholeTree,
|
||||
|
@ -147,11 +147,11 @@ class VirtualTreeElement extends CustomElement implements Renderable {
|
|||
children = const [];
|
||||
}
|
||||
|
||||
VirtualCollectionElement? _collection;
|
||||
VirtualCollectionElement _collection;
|
||||
|
||||
void render() {
|
||||
if (children.length == 0) {
|
||||
children = <Element>[_collection!.element];
|
||||
children = <Element>[_collection.element];
|
||||
}
|
||||
|
||||
final items = [];
|
||||
|
@ -179,8 +179,8 @@ class VirtualTreeElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
_depths = depths;
|
||||
_collection!.items = items;
|
||||
_collection.items = items;
|
||||
|
||||
_r.waitFor([_collection!.onRendered.first]);
|
||||
_r.waitFor([_collection.onRendered.first]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,15 @@ class ContextRefElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<ContextRefElement>('context-ref',
|
||||
dependencies: const [CurlyBlockElement.tag]);
|
||||
|
||||
late RenderingScheduler<ContextRefElement> _r;
|
||||
RenderingScheduler<ContextRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ContextRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ContextRef _context;
|
||||
late M.ObjectRepository _objects;
|
||||
M.Context? _loadedContext;
|
||||
late bool _expandable;
|
||||
M.IsolateRef _isolate;
|
||||
M.ContextRef _context;
|
||||
M.ObjectRepository _objects;
|
||||
M.Context _loadedContext;
|
||||
bool _expandable;
|
||||
bool _expanded = false;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -31,7 +31,7 @@ class ContextRefElement extends CustomElement implements Renderable {
|
|||
|
||||
factory ContextRefElement(
|
||||
M.IsolateRef isolate, M.ContextRef context, M.ObjectRepository objects,
|
||||
{RenderingQueue? queue, bool expandable: true}) {
|
||||
{RenderingQueue queue, bool expandable: true}) {
|
||||
assert(isolate != null);
|
||||
assert(context != null);
|
||||
assert(objects != null);
|
||||
|
@ -60,7 +60,7 @@ class ContextRefElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_loadedContext = await _objects.get(_isolate, _context.id!) as M.Context;
|
||||
_loadedContext = await _objects.get(_isolate, _context.id);
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class ContextRefElement extends CustomElement implements Renderable {
|
|||
return [new SpanElement()..text = 'Loading...'];
|
||||
}
|
||||
var members = <Element>[];
|
||||
if (_loadedContext!.parentContext != null) {
|
||||
if (_loadedContext.parentContext != null) {
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -113,14 +113,14 @@ class ContextRefElement extends CustomElement implements Renderable {
|
|||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new ContextRefElement(
|
||||
_isolate, _loadedContext!.parentContext!, _objects,
|
||||
_isolate, _loadedContext.parentContext, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]);
|
||||
}
|
||||
if (_loadedContext!.variables!.isNotEmpty) {
|
||||
var variables = _loadedContext!.variables!.toList();
|
||||
if (_loadedContext.variables.isNotEmpty) {
|
||||
var variables = _loadedContext.variables.toList();
|
||||
for (var index = 0; index < variables.length; index++) {
|
||||
var variable = variables[index];
|
||||
members.add(new DivElement()
|
||||
|
|
|
@ -36,21 +36,21 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ContextViewElement> _r;
|
||||
RenderingScheduler<ContextViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ContextViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Context _context;
|
||||
late M.ContextRepository _contexts;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Context _context;
|
||||
M.ContextRepository _contexts;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -69,7 +69,7 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -118,13 +118,13 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
new NavTopMenuElement(queue: _r.queue).element,
|
||||
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
|
||||
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element,
|
||||
new NavClassMenuElement(_isolate, _context.clazz!, queue: _r.queue)
|
||||
new NavClassMenuElement(_isolate, _context.clazz, queue: _r.queue)
|
||||
.element,
|
||||
navMenu('instance'),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
_context = await _contexts.get(_isolate, _context.id!);
|
||||
_context = await _contexts.get(_isolate, _context.id);
|
||||
_r.dirty();
|
||||
}))
|
||||
.element,
|
||||
|
@ -160,7 +160,7 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new ContextRefElement(
|
||||
_isolate, _context.parentContext!, _objects,
|
||||
_isolate, _context.parentContext, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -170,7 +170,7 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
}
|
||||
content.add(new HRElement());
|
||||
if (_context.variables!.isNotEmpty) {
|
||||
if (_context.variables.isNotEmpty) {
|
||||
int index = 0;
|
||||
content.addAll([
|
||||
new DivElement()
|
||||
|
@ -181,7 +181,7 @@ class ContextViewElement extends CustomElement implements Renderable {
|
|||
..content = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _context.variables!
|
||||
..children = _context.variables
|
||||
.map<Element>((variable) => new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
|
|
@ -34,21 +34,21 @@ class CpuProfileElement extends CustomElement implements Renderable {
|
|||
CpuProfileVirtualTreeElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<CpuProfileElement> _r;
|
||||
RenderingScheduler<CpuProfileElement> _r;
|
||||
|
||||
Stream<RenderedEvent<CpuProfileElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.IsolateSampleProfileRepository _profiles;
|
||||
late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress? _progress;
|
||||
late M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
late ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
late String _filter = '';
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.IsolateSampleProfileRepository _profiles;
|
||||
Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress _progress;
|
||||
M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
String _filter = '';
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
|
@ -61,7 +61,7 @@ class CpuProfileElement extends CustomElement implements Renderable {
|
|||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.IsolateSampleProfileRepository profiles,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -112,16 +112,15 @@ class CpuProfileElement extends CustomElement implements Renderable {
|
|||
children = content;
|
||||
return;
|
||||
}
|
||||
content.add((new SampleBufferControlElement(
|
||||
_vm, _progress!, _progressStream,
|
||||
content.add((new SampleBufferControlElement(_vm, _progress, _progressStream,
|
||||
selectedTag: _tag, queue: _r.queue)
|
||||
..onTagChange.listen((e) {
|
||||
_tag = e.element.selectedTag;
|
||||
_request();
|
||||
}))
|
||||
.element);
|
||||
if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
late CpuProfileVirtualTreeElement tree;
|
||||
if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
CpuProfileVirtualTreeElement tree;
|
||||
content.addAll([
|
||||
new BRElement(),
|
||||
(new StackTraceTreeConfigElement(
|
||||
|
@ -147,7 +146,7 @@ class CpuProfileElement extends CustomElement implements Renderable {
|
|||
}))
|
||||
.element,
|
||||
new BRElement(),
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
|
||||
queue: _r.queue))
|
||||
.element
|
||||
]);
|
||||
|
@ -162,7 +161,7 @@ class CpuProfileElement extends CustomElement implements Renderable {
|
|||
_r.dirty();
|
||||
_progress = (await _progressStream.first).progress;
|
||||
_r.dirty();
|
||||
if (M.isSampleProcessRunning(_progress!.status)) {
|
||||
if (M.isSampleProcessRunning(_progress.status)) {
|
||||
_progress = (await _progressStream.last).progress;
|
||||
_r.dirty();
|
||||
}
|
||||
|
|
|
@ -22,24 +22,24 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
static const tag =
|
||||
const Tag<CpuProfileVirtualTreeElement>('cpu-profile-virtual-tree');
|
||||
|
||||
late RenderingScheduler<CpuProfileVirtualTreeElement> _r;
|
||||
RenderingScheduler<CpuProfileVirtualTreeElement> _r;
|
||||
|
||||
Stream<RenderedEvent<CpuProfileVirtualTreeElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.ProfileTreeDirection _direction;
|
||||
late ProfileTreeMode _mode;
|
||||
late M.SampleProfileType _type;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.SampleProfile _profile;
|
||||
Iterable<M.CallTreeNodeFilter>? _filters;
|
||||
M.ProfileTreeDirection _direction;
|
||||
ProfileTreeMode _mode;
|
||||
M.SampleProfileType _type;
|
||||
M.IsolateRef _isolate;
|
||||
M.SampleProfile _profile;
|
||||
Iterable<M.CallTreeNodeFilter> _filters;
|
||||
|
||||
M.ProfileTreeDirection get direction => _direction;
|
||||
ProfileTreeMode get mode => _mode;
|
||||
M.SampleProfileType get type => _type;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.SampleProfile get profile => _profile;
|
||||
Iterable<M.CallTreeNodeFilter>? get filters => _filters;
|
||||
Iterable<M.CallTreeNodeFilter> get filters => _filters;
|
||||
|
||||
set direction(M.ProfileTreeDirection value) =>
|
||||
_direction = _r.checkAndReact(_direction, value);
|
||||
|
@ -49,18 +49,18 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
_r.dirty();
|
||||
}
|
||||
|
||||
factory CpuProfileVirtualTreeElement(Object? owner, M.SampleProfile profile,
|
||||
factory CpuProfileVirtualTreeElement(Object owner, M.SampleProfile profile,
|
||||
{ProfileTreeMode mode: ProfileTreeMode.function,
|
||||
M.SampleProfileType type: M.SampleProfileType.cpu,
|
||||
M.ProfileTreeDirection direction: M.ProfileTreeDirection.exclusive,
|
||||
RenderingQueue? queue}) {
|
||||
RenderingQueue queue}) {
|
||||
assert(profile != null);
|
||||
assert(mode != null);
|
||||
assert(direction != null);
|
||||
CpuProfileVirtualTreeElement e = new CpuProfileVirtualTreeElement.created();
|
||||
e._r =
|
||||
new RenderingScheduler<CpuProfileVirtualTreeElement>(e, queue: queue);
|
||||
e._isolate = owner as M.Isolate;
|
||||
e._isolate = owner;
|
||||
e._profile = profile;
|
||||
e._mode = mode;
|
||||
e._type = type;
|
||||
|
@ -83,7 +83,7 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
VirtualTreeElement? _tree;
|
||||
VirtualTreeElement _tree;
|
||||
|
||||
void render() {
|
||||
var tree;
|
||||
|
@ -123,7 +123,7 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
throw new Exception('Unknown SampleProfileType: $type');
|
||||
}
|
||||
if (filters != null) {
|
||||
tree = filters!.fold(tree, (dynamic tree, filter) {
|
||||
tree = filters.fold(tree, (tree, filter) {
|
||||
return tree?.filtered(filter);
|
||||
});
|
||||
}
|
||||
|
@ -141,9 +141,9 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
];
|
||||
return;
|
||||
} else if (tree.root.children.length == 1) {
|
||||
_tree!.expand(tree.root.children.first, autoExpandSingleChildNodes: true);
|
||||
_tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true);
|
||||
}
|
||||
children = <Element>[_tree!.element];
|
||||
children = <Element>[_tree.element];
|
||||
}
|
||||
|
||||
static HtmlElement _createCpuRow(toggle) {
|
||||
|
@ -205,13 +205,13 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
_updateLines(element.children[2].children, depth);
|
||||
if (item.children.isNotEmpty) {
|
||||
element.children[3].text =
|
||||
_tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
_tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
|
||||
element.children[5] = (new FunctionRefElement(
|
||||
_isolate, item.profileFunction.function!,
|
||||
_isolate, item.profileFunction.function,
|
||||
queue: _r.queue)
|
||||
..classes = ['name'])
|
||||
.element;
|
||||
|
@ -230,13 +230,13 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
_updateLines(element.children[2].children, depth);
|
||||
if (item.children.isNotEmpty) {
|
||||
element.children[3].text =
|
||||
_tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
_tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
|
||||
element.children[5] = (new FunctionRefElement(
|
||||
null, item.profileFunction.function!,
|
||||
null, item.profileFunction.function,
|
||||
queue: _r.queue)
|
||||
..classes = ['name'])
|
||||
.element;
|
||||
|
@ -245,7 +245,7 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
bool _searchFunction(Pattern pattern, itemDynamic) {
|
||||
M.FunctionCallTreeNode item = itemDynamic;
|
||||
return M
|
||||
.getFunctionFullName(item.profileFunction.function!)
|
||||
.getFunctionFullName(item.profileFunction.function)
|
||||
.contains(pattern);
|
||||
}
|
||||
|
||||
|
@ -258,13 +258,13 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
_updateLines(element.children[2].children, depth);
|
||||
if (item.children.isNotEmpty) {
|
||||
element.children[3].text =
|
||||
_tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
_tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
|
||||
element.children[5] =
|
||||
(new CodeRefElement(_isolate, item.profileCode.code!, queue: _r.queue)
|
||||
(new CodeRefElement(_isolate, item.profileCode.code, queue: _r.queue)
|
||||
..classes = ['name'])
|
||||
.element;
|
||||
}
|
||||
|
@ -282,20 +282,20 @@ class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
|
|||
_updateLines(element.children[2].children, depth);
|
||||
if (item.children.isNotEmpty) {
|
||||
element.children[3].text =
|
||||
_tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
_tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
|
||||
element.children[5] =
|
||||
(new CodeRefElement(null, item.profileCode.code!, queue: _r.queue)
|
||||
(new CodeRefElement(null, item.profileCode.code, queue: _r.queue)
|
||||
..classes = ['name'])
|
||||
.element;
|
||||
}
|
||||
|
||||
bool _searchCode(Pattern pattern, itemDynamic) {
|
||||
M.CodeCallTreeNode item = itemDynamic;
|
||||
return item.profileCode.code!.name!.contains(pattern);
|
||||
return item.profileCode.code.name.contains(pattern);
|
||||
}
|
||||
|
||||
static _updateLines(List<Element> lines, int n) {
|
||||
|
|
|
@ -44,17 +44,17 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
VirtualCollectionElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<CpuProfileTableElement> _r;
|
||||
RenderingScheduler<CpuProfileTableElement> _r;
|
||||
|
||||
Stream<RenderedEvent<CpuProfileTableElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.IsolateSampleProfileRepository _profiles;
|
||||
late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress? _progress;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.IsolateSampleProfileRepository _profiles;
|
||||
Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress _progress;
|
||||
final _sortingField = <_Table, _SortingField>{
|
||||
_Table.functions: _SortingField.exclusive,
|
||||
_Table.caller: _SortingField.caller,
|
||||
|
@ -78,7 +78,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.IsolateSampleProfileRepository profiles,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -129,10 +129,10 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
children = content;
|
||||
return;
|
||||
}
|
||||
content.add(new SampleBufferControlElement(_vm, _progress!, _progressStream,
|
||||
content.add(new SampleBufferControlElement(_vm, _progress, _progressStream,
|
||||
showTag: false, queue: _r.queue)
|
||||
.element);
|
||||
if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
content.add(new BRElement());
|
||||
content.addAll(_createTables());
|
||||
content.add(new BRElement());
|
||||
|
@ -141,10 +141,10 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
children = content;
|
||||
}
|
||||
|
||||
M.ProfileFunction? _selected;
|
||||
VirtualCollectionElement? _functions;
|
||||
VirtualCollectionElement? _callers;
|
||||
VirtualCollectionElement? _callees;
|
||||
M.ProfileFunction _selected;
|
||||
VirtualCollectionElement _functions;
|
||||
VirtualCollectionElement _callers;
|
||||
VirtualCollectionElement _callees;
|
||||
|
||||
List<Element> _createTables() {
|
||||
_functions = _functions ??
|
||||
|
@ -153,11 +153,11 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
search: _searchFunction,
|
||||
queue: _r.queue);
|
||||
// If there's no samples, don't populate the function list.
|
||||
_functions!.items = (_progress!.profile.sampleCount != 0)
|
||||
? _progress!.profile.functions.toList()
|
||||
_functions.items = (_progress.profile.sampleCount != 0)
|
||||
? _progress.profile.functions.toList()
|
||||
: []
|
||||
..sort(_createSorter(_Table.functions));
|
||||
_functions!.takeIntoView(_selected);
|
||||
_functions.takeIntoView(_selected);
|
||||
_callers = _callers ??
|
||||
new VirtualCollectionElement(_createCaller, _updateCaller,
|
||||
createHeader: _createCallerHeader,
|
||||
|
@ -169,13 +169,13 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
search: _searchFunction,
|
||||
queue: _r.queue);
|
||||
if (_selected != null) {
|
||||
_callers!.items = _selected!.callers.keys.toList()
|
||||
_callers.items = _selected.callers.keys.toList()
|
||||
..sort(_createSorter(_Table.caller));
|
||||
_callees!.items = _selected!.callees.keys.toList()
|
||||
_callees.items = _selected.callees.keys.toList()
|
||||
..sort(_createSorter(_Table.callee));
|
||||
} else {
|
||||
_callers!.items = const [];
|
||||
_callees!.items = const [];
|
||||
_callers.items = const [];
|
||||
_callees.items = const [];
|
||||
}
|
||||
return <Element>[
|
||||
new DivElement()
|
||||
|
@ -183,25 +183,25 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['profile-trees-all']
|
||||
..children = <Element>[_functions!.element],
|
||||
..children = <Element>[_functions.element],
|
||||
new DivElement()
|
||||
..classes = ['profile-trees-current']
|
||||
..children = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['profile-trees-caller']
|
||||
..children = <Element>[_callers!.element],
|
||||
..children = <Element>[_callers.element],
|
||||
new DivElement()
|
||||
..classes = ['profile-trees-selected']
|
||||
..children = _selected == null
|
||||
? [new SpanElement()..text = 'No element selected']
|
||||
: [
|
||||
new FunctionRefElement(_isolate, _selected!.function!,
|
||||
new FunctionRefElement(_isolate, _selected.function,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['profile-trees-callee']
|
||||
..children = <Element>[_callees!.element]
|
||||
..children = <Element>[_callees.element]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -223,7 +223,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
if (e.target is AnchorElement) {
|
||||
return;
|
||||
}
|
||||
_selected = _functions!.getItemFromElement(element);
|
||||
_selected = _functions.getItemFromElement(element);
|
||||
_r.dirty();
|
||||
});
|
||||
return element;
|
||||
|
@ -238,7 +238,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
}
|
||||
e.children[0].text = Utils.formatPercentNormalized(_getExclusiveT(item));
|
||||
e.children[1].text = Utils.formatPercentNormalized(_getInclusiveT(item));
|
||||
e.children[2].text = M.getFunctionFullName(item.function!);
|
||||
e.children[2].text = M.getFunctionFullName(item.function);
|
||||
}
|
||||
|
||||
List<HtmlElement> _createFunctionHeader() => [
|
||||
|
@ -264,7 +264,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
|
||||
bool _searchFunction(Pattern pattern, itemDynamic) {
|
||||
M.ProfileFunction item = itemDynamic;
|
||||
return M.getFunctionFullName(item.function!).contains(pattern);
|
||||
return M.getFunctionFullName(item.function).contains(pattern);
|
||||
}
|
||||
|
||||
void _setSorting(
|
||||
|
@ -298,7 +298,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
if (e.target is AnchorElement) {
|
||||
return;
|
||||
}
|
||||
_selected = _callees!.getItemFromElement(element);
|
||||
_selected = _callees.getItemFromElement(element);
|
||||
_r.dirty();
|
||||
});
|
||||
return element;
|
||||
|
@ -337,7 +337,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
if (e.target is AnchorElement) {
|
||||
return;
|
||||
}
|
||||
_selected = _callers!.getItemFromElement(element);
|
||||
_selected = _callers.getItemFromElement(element);
|
||||
_r.dirty();
|
||||
});
|
||||
return element;
|
||||
|
@ -375,7 +375,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
..onClick.listen((_) => _setSorting(table, field, direction));
|
||||
|
||||
List<Element> _createTree() {
|
||||
late CpuProfileVirtualTreeElement tree;
|
||||
CpuProfileVirtualTreeElement tree;
|
||||
return [
|
||||
(new StackTraceTreeConfigElement(
|
||||
showMode: false,
|
||||
|
@ -397,7 +397,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
}))
|
||||
.element,
|
||||
new BRElement(),
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
|
||||
(tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
|
||||
mode: ProfileTreeMode.function,
|
||||
direction: M.ProfileTreeDirection.exclusive,
|
||||
queue: _r.queue)
|
||||
|
@ -425,7 +425,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
_r.dirty();
|
||||
_progress = (await _progressStream.first).progress;
|
||||
_r.dirty();
|
||||
if (M.isSampleProcessRunning(_progress!.status)) {
|
||||
if (M.isSampleProcessRunning(_progress.status)) {
|
||||
_progress = (await _progressStream.last).progress;
|
||||
_r.dirty();
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
getter = _getCallerT;
|
||||
break;
|
||||
case _SortingField.method:
|
||||
getter = (M.ProfileFunction s) => M.getFunctionFullName(s.function!);
|
||||
getter = (M.ProfileFunction s) => M.getFunctionFullName(s.function);
|
||||
break;
|
||||
}
|
||||
switch (_sortingDirection[table]) {
|
||||
|
@ -481,9 +481,7 @@ class CpuProfileTableElement extends CustomElement implements Renderable {
|
|||
static double _getInclusiveT(M.ProfileFunction f) =>
|
||||
f.normalizedInclusiveTicks;
|
||||
double _getCalleeT(M.ProfileFunction f) =>
|
||||
_selected!.callees[f]! /
|
||||
_selected!.callees.values.reduce((a, b) => a + b);
|
||||
_selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b);
|
||||
double _getCallerT(M.ProfileFunction f) =>
|
||||
_selected!.callers[f]! /
|
||||
_selected!.callers.values.reduce((a, b) => a + b);
|
||||
_selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b);
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ class CurlyBlockToggleEvent {
|
|||
class CurlyBlockElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<CurlyBlockElement>('curly-block');
|
||||
|
||||
late RenderingScheduler<CurlyBlockElement> _r;
|
||||
RenderingScheduler<CurlyBlockElement> _r;
|
||||
|
||||
final StreamController<CurlyBlockToggleEvent> _onToggle =
|
||||
new StreamController<CurlyBlockToggleEvent>.broadcast();
|
||||
Stream<CurlyBlockToggleEvent> get onToggle => _onToggle.stream;
|
||||
Stream<RenderedEvent<CurlyBlockElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late bool _expanded;
|
||||
late bool _disabled;
|
||||
bool _expanded;
|
||||
bool _disabled;
|
||||
Iterable<Element> _content = const [];
|
||||
|
||||
bool get expanded => _expanded;
|
||||
|
@ -45,7 +45,7 @@ class CurlyBlockElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory CurlyBlockElement(
|
||||
{bool expanded: false, bool disabled: false, RenderingQueue? queue}) {
|
||||
{bool expanded: false, bool disabled: false, RenderingQueue queue}) {
|
||||
assert(expanded != null);
|
||||
assert(disabled != null);
|
||||
CurlyBlockElement e = new CurlyBlockElement.created();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,15 +13,15 @@ import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
|
|||
class ErrorRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<ErrorRefElement>('error-ref');
|
||||
|
||||
late RenderingScheduler<ErrorRefElement> _r;
|
||||
RenderingScheduler<ErrorRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late ErrorRef _error;
|
||||
ErrorRef _error;
|
||||
|
||||
ErrorRef get error => _error;
|
||||
|
||||
factory ErrorRefElement(ErrorRef error, {RenderingQueue? queue}) {
|
||||
factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) {
|
||||
assert(error != null);
|
||||
ErrorRefElement e = new ErrorRefElement.created();
|
||||
e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue);
|
||||
|
|
|
@ -22,18 +22,18 @@ class ErrorViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ErrorViewElement> _r;
|
||||
RenderingScheduler<ErrorViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ErrorViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.Error _error;
|
||||
late M.NotificationRepository _notifications;
|
||||
M.Error _error;
|
||||
M.NotificationRepository _notifications;
|
||||
|
||||
M.Error get error => _error;
|
||||
|
||||
factory ErrorViewElement(
|
||||
M.NotificationRepository notifications, M.Error error,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(error != null);
|
||||
assert(notifications != null);
|
||||
ErrorViewElement e = new ErrorViewElement.created();
|
||||
|
@ -78,7 +78,7 @@ class ErrorViewElement extends CustomElement implements Renderable {
|
|||
];
|
||||
}
|
||||
|
||||
static String _kindToString(M.ErrorKind? kind) {
|
||||
static String _kindToString(M.ErrorKind kind) {
|
||||
switch (kind) {
|
||||
case M.ErrorKind.unhandledException:
|
||||
return 'Unhandled Exception';
|
||||
|
|
|
@ -16,18 +16,18 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<EvalBoxElement>('eval-box',
|
||||
dependencies: const [InstanceRefElement.tag]);
|
||||
|
||||
late RenderingScheduler<EvalBoxElement> _r;
|
||||
RenderingScheduler<EvalBoxElement> _r;
|
||||
|
||||
Stream<RenderedEvent<EvalBoxElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ObjectRef _context;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.EvalRepository _eval;
|
||||
M.IsolateRef _isolate;
|
||||
M.ObjectRef _context;
|
||||
M.ObjectRepository _objects;
|
||||
M.EvalRepository _eval;
|
||||
final _results = <_ExpressionDescription>[];
|
||||
String? _expression = '';
|
||||
late bool _multiline;
|
||||
late Iterable<String> _quickExpressions;
|
||||
String _expression = '';
|
||||
bool _multiline;
|
||||
Iterable<String> _quickExpressions;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.ObjectRef get context => _context;
|
||||
|
@ -36,7 +36,7 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
M.ObjectRepository objects, M.EvalRepository eval,
|
||||
{bool multiline: false,
|
||||
Iterable<String> quickExpressions: const [],
|
||||
RenderingQueue? queue}) {
|
||||
RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(context != null);
|
||||
assert(objects != null);
|
||||
|
@ -139,7 +139,7 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
var area = new TextAreaElement()
|
||||
..classes = ['textbox']
|
||||
..placeholder = 'evaluate an expression'
|
||||
..value = _expression!
|
||||
..value = _expression
|
||||
..onKeyUp.where((e) => e.key == '\n').listen((e) {
|
||||
e.preventDefault();
|
||||
_run();
|
||||
|
@ -155,7 +155,7 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
var textbox = new TextInputElement()
|
||||
..classes = ['textbox']
|
||||
..placeholder = 'evaluate an expression'
|
||||
..value = _expression!
|
||||
..value = _expression
|
||||
..onKeyUp.where((e) => e.key == '\n').listen((e) {
|
||||
e.preventDefault();
|
||||
_run();
|
||||
|
@ -187,8 +187,8 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _run() async {
|
||||
if (_expression == null || _expression.isEmpty) return;
|
||||
final expression = _expression;
|
||||
if (expression == null || expression!.isEmpty) return;
|
||||
_expression = null;
|
||||
final result = new _ExpressionDescription.pending(expression);
|
||||
_results.add(result);
|
||||
|
@ -202,7 +202,7 @@ class EvalBoxElement extends CustomElement implements Renderable {
|
|||
|
||||
class _ExpressionDescription {
|
||||
final String expression;
|
||||
final M.ObjectRef? value;
|
||||
final M.ObjectRef value;
|
||||
bool get isPending => value == null;
|
||||
|
||||
_ExpressionDescription(this.expression, this.value);
|
||||
|
|
|
@ -14,21 +14,21 @@ class FieldRefElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<FieldRefElement>('field-ref',
|
||||
dependencies: const [InstanceRefElement.tag]);
|
||||
|
||||
late RenderingScheduler<FieldRefElement> _r;
|
||||
RenderingScheduler<FieldRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<FieldRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.FieldRef _field;
|
||||
late M.ObjectRepository _objects;
|
||||
late bool _expandable;
|
||||
M.IsolateRef _isolate;
|
||||
M.FieldRef _field;
|
||||
M.ObjectRepository _objects;
|
||||
bool _expandable;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.FieldRef get field => _field;
|
||||
|
||||
factory FieldRefElement(
|
||||
M.IsolateRef isolate, M.FieldRef field, M.ObjectRepository objects,
|
||||
{RenderingQueue? queue, bool expandable: true}) {
|
||||
{RenderingQueue queue, bool expandable: true}) {
|
||||
assert(isolate != null);
|
||||
assert(field != null);
|
||||
assert(objects != null);
|
||||
|
@ -58,21 +58,21 @@ class FieldRefElement extends CustomElement implements Renderable {
|
|||
|
||||
void render() {
|
||||
var header = '';
|
||||
if (_field.isStatic!) {
|
||||
if (_field.isStatic) {
|
||||
if (_field.dartOwner is M.ClassRef) {
|
||||
header += 'static ';
|
||||
} else {
|
||||
header += 'top-level ';
|
||||
}
|
||||
}
|
||||
if (_field.isFinal!) {
|
||||
if (_field.isFinal) {
|
||||
header += 'final ';
|
||||
} else if (_field.isConst!) {
|
||||
} else if (_field.isConst) {
|
||||
header += 'const ';
|
||||
} else if (_field.declaredType!.name == 'dynamic') {
|
||||
} else if (_field.declaredType.name == 'dynamic') {
|
||||
header += 'var ';
|
||||
}
|
||||
if (_field.declaredType!.name == 'dynamic') {
|
||||
if (_field.declaredType.name == 'dynamic') {
|
||||
children = <Element>[
|
||||
new SpanElement()..text = header,
|
||||
new AnchorElement(href: Uris.inspect(_isolate, object: _field))
|
||||
|
@ -81,7 +81,7 @@ class FieldRefElement extends CustomElement implements Renderable {
|
|||
} else {
|
||||
children = <Element>[
|
||||
new SpanElement()..text = header,
|
||||
new InstanceRefElement(_isolate, _field.declaredType!, _objects,
|
||||
new InstanceRefElement(_isolate, _field.declaredType, _objects,
|
||||
queue: _r.queue, expandable: _expandable)
|
||||
.element,
|
||||
new SpanElement()..text = ' ',
|
||||
|
|
|
@ -44,24 +44,24 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<FieldViewElement> _r;
|
||||
RenderingScheduler<FieldViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<FieldViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Field _field;
|
||||
M.LibraryRef? _library;
|
||||
late M.FieldRepository _fields;
|
||||
late M.ClassRepository _classes;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Field _field;
|
||||
M.LibraryRef _library;
|
||||
M.FieldRepository _fields;
|
||||
M.ClassRepository _classes;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ScriptRepository _scripts;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -82,7 +82,7 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
M.RetainingPathRepository retainingPaths,
|
||||
M.ScriptRepository scripts,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -112,7 +112,7 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
e._scripts = scripts;
|
||||
e._objects = objects;
|
||||
if (field.dartOwner is M.LibraryRef) {
|
||||
e._library = field.dartOwner as M.LibraryRef;
|
||||
e._library = field.dartOwner;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
@ -135,22 +135,22 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
|
||||
void render() {
|
||||
var header = '';
|
||||
if (_field.isStatic!) {
|
||||
if (_field.isStatic) {
|
||||
if (_field.dartOwner is M.ClassRef) {
|
||||
header += 'static ';
|
||||
} else {
|
||||
header += 'top-level ';
|
||||
}
|
||||
}
|
||||
if (_field.isFinal!) {
|
||||
if (_field.isFinal) {
|
||||
header += 'final ';
|
||||
} else if (_field.isConst!) {
|
||||
} else if (_field.isConst) {
|
||||
header += 'const ';
|
||||
}
|
||||
if (_field.declaredType!.name == 'dynamic') {
|
||||
if (_field.declaredType.name == 'dynamic') {
|
||||
header += 'var';
|
||||
} else {
|
||||
header += _field.declaredType!.name!;
|
||||
header += _field.declaredType.name;
|
||||
}
|
||||
children = <Element>[
|
||||
navBar(_createMenu()),
|
||||
|
@ -172,10 +172,10 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
..children = _field.location == null
|
||||
? const []
|
||||
: [
|
||||
new ScriptInsetElement(_isolate, _field.location!.script,
|
||||
new ScriptInsetElement(_isolate, _field.location.script,
|
||||
_scripts, _objects, _events,
|
||||
startPos: field.location!.tokenPos,
|
||||
endPos: field.location!.tokenPos,
|
||||
startPos: field.location.tokenPos,
|
||||
endPos: field.location.tokenPos,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
],
|
||||
|
@ -191,15 +191,15 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
|
||||
];
|
||||
if (_library != null) {
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
|
||||
.element);
|
||||
} else if (_field.dartOwner is M.ClassRef) {
|
||||
menu.add(new NavClassMenuElement(_isolate, _field.dartOwner as M.ClassRef,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
menu.add(
|
||||
new NavClassMenuElement(_isolate, _field.dartOwner, queue: _r.queue)
|
||||
.element);
|
||||
}
|
||||
menu.addAll(<Element>[
|
||||
navMenu(_field.name!),
|
||||
navMenu(_field.name),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) {
|
||||
e.element.disabled = true;
|
||||
|
@ -237,13 +237,13 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new SourceLinkElement(_isolate, field.location!, _scripts,
|
||||
new SourceLinkElement(_isolate, field.location, _scripts,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]
|
||||
];
|
||||
if (!_field.isStatic!) {
|
||||
if (!_field.isStatic) {
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..title = 'The types observed for this field at runtime. '
|
||||
|
@ -286,23 +286,22 @@ class FieldViewElement extends CustomElement implements Renderable {
|
|||
break;
|
||||
case M.GuardClassKind.single:
|
||||
guard.add(
|
||||
new ClassRefElement(_isolate, _field.guardClass!, queue: _r.queue)
|
||||
new ClassRefElement(_isolate, _field.guardClass, queue: _r.queue)
|
||||
.element);
|
||||
break;
|
||||
}
|
||||
guard.add(new SpanElement()
|
||||
..text =
|
||||
_field.guardNullable! ? '— null observed' : '— null not observed');
|
||||
_field.guardNullable ? '— null observed' : '— null not observed');
|
||||
return guard;
|
||||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_field = await _fields.get(_isolate, _field.id!);
|
||||
_field = await _fields.get(_isolate, _field.id);
|
||||
if (_field.dartOwner is M.LibraryRef) {
|
||||
_library = _field.dartOwner as M.LibraryRef;
|
||||
_library = _field.dartOwner;
|
||||
} else if (_field.dartOwner is M.ClassRef) {
|
||||
var cls = _field.dartOwner as M.ClassRef;
|
||||
_library = (await _classes.get(_isolate, cls.id!)).library!;
|
||||
_library = (await _classes.get(_isolate, _field.dartOwner.id)).library;
|
||||
}
|
||||
_r.dirty();
|
||||
}
|
||||
|
|
|
@ -28,21 +28,21 @@ class FlagListElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<FlagListElement> _r;
|
||||
RenderingScheduler<FlagListElement> _r;
|
||||
|
||||
Stream<RenderedEvent<FlagListElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VMRef _vm;
|
||||
late M.EventRepository _events;
|
||||
late M.FlagsRepository _repository;
|
||||
late M.NotificationRepository _notifications;
|
||||
Iterable<M.Flag>? _flags;
|
||||
M.VMRef _vm;
|
||||
M.EventRepository _events;
|
||||
M.FlagsRepository _repository;
|
||||
M.NotificationRepository _notifications;
|
||||
Iterable<M.Flag> _flags;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
|
||||
factory FlagListElement(M.VMRef vm, M.EventRepository events,
|
||||
M.FlagsRepository repository, M.NotificationRepository notifications,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(events != null);
|
||||
assert(repository != null);
|
||||
|
@ -77,8 +77,8 @@ class FlagListElement extends CustomElement implements Renderable {
|
|||
if (_flags == null) {
|
||||
content.add(new HeadingElement.h1()..text = 'Loading Flags...');
|
||||
} else {
|
||||
final modified = _flags!.where(_isModified);
|
||||
final unmodified = _flags!.where(_isUnmodified);
|
||||
final modified = _flags.where(_isModified);
|
||||
final unmodified = _flags.where(_isUnmodified);
|
||||
|
||||
if (modified.isNotEmpty) {
|
||||
content.add(new HeadingElement.h1()..text = 'Modified Flags');
|
||||
|
@ -100,7 +100,7 @@ class FlagListElement extends CustomElement implements Renderable {
|
|||
children = <Element>[
|
||||
navBar(<Element>[
|
||||
new NavTopMenuElement(queue: _r.queue).element,
|
||||
new NavVMMenuElement(_vm as M.VM, _events, queue: _r.queue).element,
|
||||
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
|
||||
navMenu('flags', link: Uris.flags()),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
|
@ -146,7 +146,7 @@ class FlagListElement extends CustomElement implements Renderable {
|
|||
new SpanElement()..text = '=',
|
||||
new SpanElement()
|
||||
..classes = ['value']
|
||||
..text = flag.valueAsString
|
||||
..text = flag.valueAsString ?? 'NULL'
|
||||
],
|
||||
new BRElement(),
|
||||
];
|
||||
|
|
|
@ -22,20 +22,20 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class FunctionRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<FunctionRefElement>('function-ref');
|
||||
|
||||
late RenderingScheduler<FunctionRefElement> _r;
|
||||
RenderingScheduler<FunctionRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<FunctionRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
M.IsolateRef? _isolate;
|
||||
late M.FunctionRef _function;
|
||||
late bool _qualified;
|
||||
M.IsolateRef _isolate;
|
||||
M.FunctionRef _function;
|
||||
bool _qualified;
|
||||
|
||||
M.IsolateRef? get isolate => _isolate;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.FunctionRef get function => _function;
|
||||
bool get qualified => _qualified;
|
||||
|
||||
factory FunctionRefElement(M.IsolateRef? isolate, M.FunctionRef function,
|
||||
{bool qualified: true, RenderingQueue? queue}) {
|
||||
factory FunctionRefElement(M.IsolateRef isolate, M.FunctionRef function,
|
||||
{bool qualified: true, RenderingQueue queue}) {
|
||||
assert(function != null);
|
||||
assert(qualified != null);
|
||||
FunctionRefElement e = new FunctionRefElement.created();
|
||||
|
@ -67,11 +67,11 @@ class FunctionRefElement extends CustomElement implements Renderable {
|
|||
new AnchorElement(
|
||||
href: (M.isSyntheticFunction(_function.kind) || (_isolate == null))
|
||||
? null
|
||||
: Uris.inspect(_isolate!, object: _function))
|
||||
: Uris.inspect(_isolate, object: _function))
|
||||
..text = _function.name
|
||||
];
|
||||
if (qualified) {
|
||||
M.ObjectRef? owner = _function.dartOwner;
|
||||
M.ObjectRef owner = _function.dartOwner;
|
||||
while (owner is M.FunctionRef) {
|
||||
M.FunctionRef function = (owner as M.FunctionRef);
|
||||
content.addAll([
|
||||
|
@ -79,7 +79,7 @@ class FunctionRefElement extends CustomElement implements Renderable {
|
|||
new AnchorElement(
|
||||
href: (M.isSyntheticFunction(function.kind) || (_isolate == null))
|
||||
? null
|
||||
: Uris.inspect(_isolate!, object: function))
|
||||
: Uris.inspect(_isolate, object: function))
|
||||
..text = function.name
|
||||
]);
|
||||
owner = function.dartOwner;
|
||||
|
@ -87,8 +87,7 @@ class FunctionRefElement extends CustomElement implements Renderable {
|
|||
if (owner is M.ClassRef) {
|
||||
content.addAll([
|
||||
new SpanElement()..text = '.',
|
||||
new ClassRefElement(_isolate!, owner as M.ClassRef, queue: _r.queue)
|
||||
.element
|
||||
new ClassRefElement(_isolate, owner, queue: _r.queue).element
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,24 +50,24 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<FunctionViewElement> _r;
|
||||
RenderingScheduler<FunctionViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<FunctionViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.ServiceFunction _function;
|
||||
M.LibraryRef? _library;
|
||||
late M.FunctionRepository _functions;
|
||||
late M.ClassRepository _classes;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.ServiceFunction _function;
|
||||
M.LibraryRef _library;
|
||||
M.FunctionRepository _functions;
|
||||
M.ClassRepository _classes;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ScriptRepository _scripts;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -88,7 +88,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
M.RetainingPathRepository retainingPaths,
|
||||
M.ScriptRepository scripts,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -118,7 +118,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
e._scripts = scripts;
|
||||
e._objects = objects;
|
||||
if (function.dartOwner is M.LibraryRef) {
|
||||
e._library = function.dartOwner as M.LibraryRef;
|
||||
e._library = function.dartOwner;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..children = _function.location == null
|
||||
? const []
|
||||
: [
|
||||
new SourceInsetElement(_isolate, _function.location!,
|
||||
new SourceInsetElement(_isolate, _function.location,
|
||||
_scripts, _objects, _events,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
|
@ -177,16 +177,15 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
|
||||
];
|
||||
if (_library != null) {
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
|
||||
.element);
|
||||
} else if (_function.dartOwner is M.ClassRef) {
|
||||
menu.add(new NavClassMenuElement(
|
||||
_isolate, _function.dartOwner as M.ClassRef,
|
||||
menu.add(new NavClassMenuElement(_isolate, _function.dartOwner,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
}
|
||||
menu.addAll(<Element>[
|
||||
navMenu(_function.name!),
|
||||
navMenu(_function.name),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) {
|
||||
e.element.disabled = true;
|
||||
|
@ -210,8 +209,8 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new SpanElement()
|
||||
..text = '${_function.isStatic! ? "static " : ""}'
|
||||
'${_function.isConst! ? "const " : ""}'
|
||||
..text = '${_function.isStatic ? "static " : ""}'
|
||||
'${_function.isConst ? "const " : ""}'
|
||||
'${_functionKindToString(_function.kind)}'
|
||||
]
|
||||
],
|
||||
|
@ -241,7 +240,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new FieldRefElement(_isolate, _function.field!, _objects,
|
||||
new FieldRefElement(_isolate, _function.field, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -256,7 +255,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new SourceLinkElement(_isolate, _function.location!, _scripts,
|
||||
new SourceLinkElement(_isolate, _function.location, _scripts,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -271,7 +270,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new CodeRefElement(_isolate, _function.code!, queue: _r.queue)
|
||||
new CodeRefElement(_isolate, _function.code, queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
]);
|
||||
|
@ -286,7 +285,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new CodeRefElement(_isolate, _function.unoptimizedCode!,
|
||||
new CodeRefElement(_isolate, _function.unoptimizedCode,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()
|
||||
|
@ -307,7 +306,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new CodeRefElement(_isolate, _function.bytecode!, queue: _r.queue)
|
||||
new CodeRefElement(_isolate, _function.bytecode, queue: _r.queue)
|
||||
.element,
|
||||
]
|
||||
]);
|
||||
|
@ -326,7 +325,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
new InstanceRefElement(_isolate, _function.icDataArray!, _objects,
|
||||
new InstanceRefElement(_isolate, _function.icDataArray, _objects,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -352,7 +351,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..text = 'optimizable',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = _function.isOptimizable! ? 'yes' : 'no'
|
||||
..text = _function.isOptimizable ? 'yes' : 'no'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -362,7 +361,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..text = 'inlinable',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = _function.isInlinable! ? 'yes' : 'no'
|
||||
..text = _function.isInlinable ? 'yes' : 'no'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -372,7 +371,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..text = 'intrinsic',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = _function.hasIntrinsic! ? 'yes' : 'no'
|
||||
..text = _function.hasIntrinsic ? 'yes' : 'no'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -382,7 +381,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..text = 'recognized',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = _function.isRecognized! ? 'yes' : 'no'
|
||||
..text = _function.isRecognized ? 'yes' : 'no'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -392,7 +391,7 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
..text = 'native',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = _function.isNative! ? 'yes' : 'no'
|
||||
..text = _function.isNative ? 'yes' : 'no'
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -409,17 +408,16 @@ class FunctionViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_function = await _functions.get(_isolate, _function.id!);
|
||||
_function = await _functions.get(_isolate, _function.id);
|
||||
if (_function.dartOwner is M.LibraryRef) {
|
||||
_library = _function.dartOwner as M.LibraryRef;
|
||||
_library = _function.dartOwner;
|
||||
} else if (_function.dartOwner is M.ClassRef) {
|
||||
var cls = _function.dartOwner as M.ClassRef;
|
||||
_library = (await _classes.get(_isolate, cls.id!)).library!;
|
||||
_library = (await _classes.get(_isolate, _function.dartOwner.id)).library;
|
||||
}
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
static String _functionKindToString(M.FunctionKind? kind) {
|
||||
static String _functionKindToString(M.FunctionKind kind) {
|
||||
switch (kind) {
|
||||
case M.FunctionKind.regular:
|
||||
return 'regular';
|
||||
|
|
|
@ -17,19 +17,19 @@ class GeneralErrorElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<GeneralErrorElement>('general-error',
|
||||
dependencies: const [NavTopMenuElement.tag, NavNotifyElement.tag]);
|
||||
|
||||
late RenderingScheduler<GeneralErrorElement> _r;
|
||||
RenderingScheduler<GeneralErrorElement> _r;
|
||||
|
||||
Stream<RenderedEvent<GeneralErrorElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.NotificationRepository _notifications;
|
||||
late String _message;
|
||||
M.NotificationRepository _notifications;
|
||||
String _message;
|
||||
|
||||
String get message => _message;
|
||||
|
||||
set message(String value) => _message = _r.checkAndReact(_message, value);
|
||||
|
||||
factory GeneralErrorElement(M.NotificationRepository notifications,
|
||||
{String message: '', RenderingQueue? queue}) {
|
||||
{String message: '', RenderingQueue queue}) {
|
||||
assert(notifications != null);
|
||||
assert(message != null);
|
||||
GeneralErrorElement e = new GeneralErrorElement.created();
|
||||
|
|
|
@ -29,21 +29,21 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
NavNotifyElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<HeapMapElement> _r;
|
||||
RenderingScheduler<HeapMapElement> _r;
|
||||
|
||||
Stream<RenderedEvent<HeapMapElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
|
||||
factory HeapMapElement(M.VM vm, M.IsolateRef isolate,
|
||||
M.EventRepository events, M.NotificationRepository notifications,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -73,9 +73,9 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
CanvasElement? _canvas;
|
||||
dynamic _fragmentationData;
|
||||
int? _pageHeight;
|
||||
CanvasElement _canvas;
|
||||
var _fragmentationData;
|
||||
double _pageHeight;
|
||||
final _classIdToColor = {};
|
||||
final _colorToClassId = {};
|
||||
final _classIdToName = {};
|
||||
|
@ -87,8 +87,8 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
// TODO(koda): Improve interface for huge heaps.
|
||||
static const _MAX_CANVAS_HEIGHT = 6000;
|
||||
|
||||
String _status = 'Loading';
|
||||
S.ServiceMap? _fragmentation;
|
||||
String _status;
|
||||
S.ServiceMap _fragmentation;
|
||||
|
||||
void render() {
|
||||
if (_canvas == null) {
|
||||
|
@ -99,7 +99,7 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
// Set hover text to describe the object under the cursor.
|
||||
_canvas!.title = _status;
|
||||
_canvas.title = _status;
|
||||
|
||||
children = <Element>[
|
||||
navBar(<Element>[
|
||||
|
@ -129,7 +129,7 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
],
|
||||
new DivElement()
|
||||
..classes = ['flex-row']
|
||||
..children = <Element>[_canvas!]
|
||||
..children = <Element>[_canvas]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -158,9 +158,9 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
print('Ignoring non-class in class list');
|
||||
continue;
|
||||
}
|
||||
var classId = int.parse(member.id!.split('/').last);
|
||||
var classId = int.parse(member.id.split('/').last);
|
||||
var color = _classIdToRGBA(classId);
|
||||
_addClass(classId, member.name!, color);
|
||||
_addClass(classId, member.name, color);
|
||||
}
|
||||
_addClass(freeClassId, 'Free', _freeColor);
|
||||
_addClass(0, '', _pageSeparationColor);
|
||||
|
@ -177,15 +177,15 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
return _classIdToName[_colorToClassId[_packColor(color)]];
|
||||
}
|
||||
|
||||
ObjectInfo? _objectAt(Point<num> point) {
|
||||
ObjectInfo _objectAt(Point<num> point) {
|
||||
if (_fragmentation == null || _canvas == null) {
|
||||
return null;
|
||||
}
|
||||
var pagePixels = _pageHeight! * _fragmentationData.width;
|
||||
var pagePixels = _pageHeight * _fragmentationData.width;
|
||||
var index = new PixelReference(_fragmentationData, point).index;
|
||||
var pageIndex = index ~/ pagePixels;
|
||||
num pageOffset = index % pagePixels;
|
||||
var pages = _fragmentation!['pages'];
|
||||
var pages = _fragmentation['pages'];
|
||||
if (pageIndex < 0 || pageIndex >= pages.length) {
|
||||
return null;
|
||||
}
|
||||
|
@ -204,8 +204,8 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
}
|
||||
return new ObjectInfo(
|
||||
int.parse(page['objectStart']) +
|
||||
pageOffset * _fragmentation!['unitSizeBytes'],
|
||||
size * _fragmentation!['unitSizeBytes']);
|
||||
pageOffset * _fragmentation['unitSizeBytes'],
|
||||
size * _fragmentation['unitSizeBytes']);
|
||||
}
|
||||
|
||||
void _handleMouseMove(MouseEvent event) {
|
||||
|
@ -226,28 +226,28 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
return;
|
||||
}
|
||||
_updateClassList(
|
||||
_fragmentation!['classList'], _fragmentation!['freeClassId']);
|
||||
var pages = _fragmentation!['pages'];
|
||||
var width = max(_canvas!.parent!.client.width, 1) as int;
|
||||
_fragmentation['classList'], _fragmentation['freeClassId']);
|
||||
var pages = _fragmentation['pages'];
|
||||
var width = max(_canvas.parent.client.width, 1);
|
||||
_pageHeight = _PAGE_SEPARATION_HEIGHT +
|
||||
(_fragmentation!['pageSizeBytes'] as int) ~/
|
||||
(_fragmentation!['unitSizeBytes'] as int) ~/
|
||||
_fragmentation['pageSizeBytes'] ~/
|
||||
_fragmentation['unitSizeBytes'] ~/
|
||||
width;
|
||||
var height = min(_pageHeight! * pages.length, _MAX_CANVAS_HEIGHT) as int;
|
||||
_fragmentationData = _canvas!.context2D.createImageData(width, height);
|
||||
_canvas!.width = _fragmentationData.width;
|
||||
_canvas!.height = _fragmentationData.height;
|
||||
var height = min(_pageHeight * pages.length, _MAX_CANVAS_HEIGHT);
|
||||
_fragmentationData = _canvas.context2D.createImageData(width, height);
|
||||
_canvas.width = _fragmentationData.width;
|
||||
_canvas.height = _fragmentationData.height;
|
||||
_renderPages(0);
|
||||
}
|
||||
|
||||
// Renders and draws asynchronously, one page at a time to avoid
|
||||
// blocking the UI.
|
||||
void _renderPages(int startPage) {
|
||||
var pages = _fragmentation!['pages'];
|
||||
var pages = _fragmentation['pages'];
|
||||
_status = 'Loaded $startPage of ${pages.length} pages';
|
||||
_r.dirty();
|
||||
var startY = (startPage * _pageHeight!).round();
|
||||
var endY = startY + _pageHeight!.round();
|
||||
var startY = (startPage * _pageHeight).round();
|
||||
var endY = startY + _pageHeight.round();
|
||||
if (startPage >= pages.length || endY > _fragmentationData.height) {
|
||||
return;
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
pixel.color = _pageSeparationColor;
|
||||
pixel = pixel.next();
|
||||
}
|
||||
_canvas!.context2D.putImageData(
|
||||
_canvas.context2D.putImageData(
|
||||
_fragmentationData, 0, 0, 0, startY, _fragmentationData.width, endY);
|
||||
// Continue with the next page, asynchronously.
|
||||
new Future(() {
|
||||
|
@ -274,14 +274,14 @@ class HeapMapElement extends CustomElement implements Renderable {
|
|||
});
|
||||
}
|
||||
|
||||
Future _refresh({String? gc}) {
|
||||
Future _refresh({String gc}) {
|
||||
final isolate = _isolate as S.Isolate;
|
||||
var params = {};
|
||||
if (gc != null) {
|
||||
params['gc'] = gc;
|
||||
}
|
||||
return isolate.invokeRpc('_getHeapMap', params).then((serviceObject) {
|
||||
S.ServiceMap response = serviceObject as S.ServiceMap;
|
||||
S.ServiceMap response = serviceObject;
|
||||
assert(response['type'] == 'HeapMap');
|
||||
_fragmentation = response;
|
||||
_updateFragmentationData();
|
||||
|
|
|
@ -190,9 +190,9 @@ class MergedDominatorDiffTreeMap extends DiffTreeMap<MergedDominatorDiff> {
|
|||
|
||||
String getType(MergedDominatorDiff node) => node.name;
|
||||
String getName(MergedDominatorDiff node) => "instances of ${node.name}";
|
||||
MergedDominatorDiff? getParent(MergedDominatorDiff node) => node.parent;
|
||||
MergedDominatorDiff getParent(MergedDominatorDiff node) => node.parent;
|
||||
Iterable<MergedDominatorDiff> getChildren(MergedDominatorDiff node) =>
|
||||
node.children!;
|
||||
node.children;
|
||||
void onSelect(MergedDominatorDiff node) {
|
||||
element.mergedDiffSelection = node;
|
||||
element._r.dirty();
|
||||
|
@ -220,7 +220,7 @@ class ClassesShallowTreeMap extends NormalTreeMap<SnapshotClass> {
|
|||
? "${snapshot.classes.length} classes"
|
||||
: "${node.instanceCount} instances of ${node.name}";
|
||||
|
||||
SnapshotClass? getParent(SnapshotClass node) => null;
|
||||
SnapshotClass getParent(SnapshotClass node) => null;
|
||||
Iterable<SnapshotClass> getChildren(SnapshotClass node) =>
|
||||
node == null ? snapshot.classes : <SnapshotClass>[];
|
||||
void onSelect(SnapshotClass node) {}
|
||||
|
@ -277,7 +277,7 @@ class ClassesShallowDiffTreeMap extends DiffTreeMap<SnapshotClassDiff> {
|
|||
node == null ? "Classes" : node.name;
|
||||
String getName(SnapshotClassDiff node) =>
|
||||
node == null ? "${classes.length} classes" : "instances of ${node.name}";
|
||||
SnapshotClassDiff? getParent(SnapshotClassDiff node) => null;
|
||||
SnapshotClassDiff getParent(SnapshotClassDiff node) => null;
|
||||
Iterable<SnapshotClassDiff> getChildren(SnapshotClassDiff node) =>
|
||||
node == null ? classes : <SnapshotClassDiff>[];
|
||||
void onSelect(SnapshotClassDiff node) {}
|
||||
|
@ -302,7 +302,7 @@ class ClassesOwnershipTreeMap extends NormalTreeMap<SnapshotClass> {
|
|||
String getName(SnapshotClass node) => node == null
|
||||
? "${snapshot.classes.length} Classes"
|
||||
: "${node.instanceCount} instances of ${node.name}";
|
||||
SnapshotClass? getParent(SnapshotClass node) => null;
|
||||
SnapshotClass getParent(SnapshotClass node) => null;
|
||||
Iterable<SnapshotClass> getChildren(SnapshotClass node) =>
|
||||
node == null ? snapshot.classes : <SnapshotClass>[];
|
||||
void onSelect(SnapshotClass node) {}
|
||||
|
@ -359,7 +359,7 @@ class ClassesOwnershipDiffTreeMap extends DiffTreeMap<SnapshotClassDiff> {
|
|||
node == null ? "Classes" : node.name;
|
||||
String getName(SnapshotClassDiff node) =>
|
||||
node == null ? "${classes.length} classes" : "instances of ${node.name}";
|
||||
SnapshotClassDiff? getParent(SnapshotClassDiff node) => null;
|
||||
SnapshotClassDiff getParent(SnapshotClassDiff node) => null;
|
||||
Iterable<SnapshotClassDiff> getChildren(SnapshotClassDiff node) =>
|
||||
node == null ? classes : <SnapshotClassDiff>[];
|
||||
void onSelect(SnapshotClassDiff node) {}
|
||||
|
@ -378,10 +378,10 @@ class ProcessTreeMap extends NormalTreeMap<String> {
|
|||
|
||||
ProcessTreeMap(this.element, this.snapshot);
|
||||
|
||||
int getSize(String node) => snapshot.processPartitions[node] ?? 0;
|
||||
int getSize(String node) => snapshot.processPartitions[node];
|
||||
String getType(String node) => node;
|
||||
String getName(String node) => node;
|
||||
String? getParent(String node) => node == root ? null : root;
|
||||
String getParent(String node) => node == root ? null : root;
|
||||
Iterable<String> getChildren(String node) {
|
||||
if (node == root) {
|
||||
var children = snapshot.processPartitions.keys.toList();
|
||||
|
@ -407,22 +407,22 @@ class ProcessDiffTreeMap extends DiffTreeMap<PartitionDiff> {
|
|||
int getCommon(PartitionDiff node) => node.sizeCommon;
|
||||
String getType(PartitionDiff node) => node.name;
|
||||
String getName(PartitionDiff node) => node.name;
|
||||
PartitionDiff? getParent(PartitionDiff node) => node.parent;
|
||||
Iterable<PartitionDiff> getChildren(PartitionDiff node) => node.children!;
|
||||
PartitionDiff getParent(PartitionDiff node) => node.parent;
|
||||
Iterable<PartitionDiff> getChildren(PartitionDiff node) => node.children;
|
||||
void onSelect(PartitionDiff node) {}
|
||||
void onDetails(PartitionDiff node) {}
|
||||
}
|
||||
|
||||
class PartitionDiff {
|
||||
String name = "";
|
||||
String name;
|
||||
int sizeA = 0;
|
||||
int sizeB = 0;
|
||||
int sizeGain = -1;
|
||||
int sizeLoss = -1;
|
||||
int sizeCommon = -1;
|
||||
|
||||
PartitionDiff? parent;
|
||||
List<PartitionDiff>? children;
|
||||
PartitionDiff parent;
|
||||
List<PartitionDiff> children;
|
||||
|
||||
static PartitionDiff from(SnapshotGraph graphA, SnapshotGraph graphB) {
|
||||
var partitions = new Set<String>();
|
||||
|
@ -460,7 +460,7 @@ class PartitionDiff {
|
|||
rootDiff.sizeGain += partitionDiff.sizeGain;
|
||||
rootDiff.sizeCommon += partitionDiff.sizeCommon;
|
||||
rootDiff.sizeLoss += partitionDiff.sizeLoss;
|
||||
rootDiff.children!.add(partitionDiff);
|
||||
rootDiff.children.add(partitionDiff);
|
||||
}
|
||||
|
||||
var shallowA = rootDiff.sizeA - childrenA;
|
||||
|
@ -480,16 +480,16 @@ class PartitionDiff {
|
|||
}
|
||||
|
||||
class SnapshotClassDiff {
|
||||
SnapshotClass? _a;
|
||||
SnapshotClass? _b;
|
||||
SnapshotClass _a;
|
||||
SnapshotClass _b;
|
||||
|
||||
int get shallowSizeA => _a == null ? 0 : _a!.shallowSize;
|
||||
int get ownedSizeA => _a == null ? 0 : _a!.ownedSize;
|
||||
int get instanceCountA => _a == null ? 0 : _a!.instanceCount;
|
||||
int get shallowSizeA => _a == null ? 0 : _a.shallowSize;
|
||||
int get ownedSizeA => _a == null ? 0 : _a.ownedSize;
|
||||
int get instanceCountA => _a == null ? 0 : _a.instanceCount;
|
||||
|
||||
int get shallowSizeB => _b == null ? 0 : _b!.shallowSize;
|
||||
int get ownedSizeB => _b == null ? 0 : _b!.ownedSize;
|
||||
int get instanceCountB => _b == null ? 0 : _b!.instanceCount;
|
||||
int get shallowSizeB => _b == null ? 0 : _b.shallowSize;
|
||||
int get ownedSizeB => _b == null ? 0 : _b.ownedSize;
|
||||
int get instanceCountB => _b == null ? 0 : _b.instanceCount;
|
||||
|
||||
int get shallowSizeDiff => shallowSizeB - shallowSizeA;
|
||||
int get ownedSizeDiff => ownedSizeB - ownedSizeA;
|
||||
|
@ -507,12 +507,12 @@ class SnapshotClassDiff {
|
|||
shallowSizeB > shallowSizeA ? shallowSizeA : shallowSizeB;
|
||||
int get ownedSizeCommon => ownedSizeB > ownedSizeA ? ownedSizeA : ownedSizeB;
|
||||
|
||||
String get name => _a == null ? _b!.name : _a!.name;
|
||||
String get name => _a == null ? _b.name : _a.name;
|
||||
|
||||
List<SnapshotObject> get objectsA =>
|
||||
_a == null ? const <SnapshotObject>[] : _a!.instances.toList();
|
||||
_a == null ? <SnapshotObject>[] : _a.instances.toList();
|
||||
List<SnapshotObject> get objectsB =>
|
||||
_b == null ? const <SnapshotObject>[] : _b!.instances.toList();
|
||||
_b == null ? <SnapshotObject>[] : _b.instances.toList();
|
||||
|
||||
static List<SnapshotClassDiff> from(
|
||||
SnapshotGraph graphA, SnapshotGraph graphB) {
|
||||
|
@ -544,32 +544,32 @@ class SnapshotClassDiff {
|
|||
}
|
||||
|
||||
class MergedDominatorDiff {
|
||||
SnapshotMergedDominator? _a;
|
||||
SnapshotMergedDominator? _b;
|
||||
MergedDominatorDiff? parent;
|
||||
List<MergedDominatorDiff>? children;
|
||||
SnapshotMergedDominator _a;
|
||||
SnapshotMergedDominator _b;
|
||||
MergedDominatorDiff parent;
|
||||
List<MergedDominatorDiff> children;
|
||||
int retainedGain = -1;
|
||||
int retainedLoss = -1;
|
||||
int retainedCommon = -1;
|
||||
|
||||
int get shallowSizeA => _a == null ? 0 : _a!.shallowSize;
|
||||
int get retainedSizeA => _a == null ? 0 : _a!.retainedSize;
|
||||
int get instanceCountA => _a == null ? 0 : _a!.instanceCount;
|
||||
int get shallowSizeA => _a == null ? 0 : _a.shallowSize;
|
||||
int get retainedSizeA => _a == null ? 0 : _a.retainedSize;
|
||||
int get instanceCountA => _a == null ? 0 : _a.instanceCount;
|
||||
|
||||
int get shallowSizeB => _b == null ? 0 : _b!.shallowSize;
|
||||
int get retainedSizeB => _b == null ? 0 : _b!.retainedSize;
|
||||
int get instanceCountB => _b == null ? 0 : _b!.instanceCount;
|
||||
int get shallowSizeB => _b == null ? 0 : _b.shallowSize;
|
||||
int get retainedSizeB => _b == null ? 0 : _b.retainedSize;
|
||||
int get instanceCountB => _b == null ? 0 : _b.instanceCount;
|
||||
|
||||
int get shallowSizeDiff => shallowSizeB - shallowSizeA;
|
||||
int get retainedSizeDiff => retainedSizeB - retainedSizeA;
|
||||
int get instanceCountDiff => instanceCountB - instanceCountA;
|
||||
|
||||
String get name => _a == null ? _b!.klass.name : _a!.klass.name;
|
||||
String get name => _a == null ? _b.klass.name : _a.klass.name;
|
||||
|
||||
List<SnapshotObject> get objectsA =>
|
||||
_a == null ? const <SnapshotObject>[] : _a!.objects.toList();
|
||||
_a == null ? <SnapshotObject>[] : _a.objects.toList();
|
||||
List<SnapshotObject> get objectsB =>
|
||||
_b == null ? const <SnapshotObject>[] : _b!.objects.toList();
|
||||
_b == null ? <SnapshotObject>[] : _b.objects.toList();
|
||||
|
||||
static MergedDominatorDiff from(
|
||||
SnapshotMergedDominator a, SnapshotMergedDominator b) {
|
||||
|
@ -602,11 +602,11 @@ class MergedDominatorDiff {
|
|||
// Matching children by MergedObjectVertex.klass.qualifiedName.
|
||||
final childrenB = <String, SnapshotMergedDominator>{};
|
||||
if (_b != null)
|
||||
for (var childB in _b!.children) {
|
||||
for (var childB in _b.children) {
|
||||
childrenB[childB.klass.qualifiedName] = childB;
|
||||
}
|
||||
if (_a != null)
|
||||
for (var childA in _a!.children) {
|
||||
for (var childA in _a.children) {
|
||||
var childDiff = new MergedDominatorDiff();
|
||||
childDiff.parent = this;
|
||||
childDiff._a = childA;
|
||||
|
@ -616,18 +616,18 @@ class MergedDominatorDiff {
|
|||
childrenB.remove(qualifiedName);
|
||||
childDiff._b = childB;
|
||||
}
|
||||
children!.add(childDiff);
|
||||
children.add(childDiff);
|
||||
worklist.add(childDiff);
|
||||
}
|
||||
for (var childB in childrenB.values) {
|
||||
var childDiff = new MergedDominatorDiff();
|
||||
childDiff.parent = this;
|
||||
childDiff._b = childB;
|
||||
children!.add(childDiff);
|
||||
children.add(childDiff);
|
||||
worklist.add(childDiff);
|
||||
}
|
||||
|
||||
if (children!.length == 0) {
|
||||
if (children.length == 0) {
|
||||
// Compress.
|
||||
children = const <MergedDominatorDiff>[];
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ class MergedDominatorDiff {
|
|||
int g = 0;
|
||||
int l = 0;
|
||||
int c = 0;
|
||||
for (var child in children!) {
|
||||
for (var child in children) {
|
||||
g += child.retainedGain;
|
||||
l += child.retainedLoss;
|
||||
c += child.retainedCommon;
|
||||
|
@ -669,30 +669,30 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
VirtualTreeElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<HeapSnapshotElement> _r;
|
||||
RenderingScheduler<HeapSnapshotElement> _r;
|
||||
|
||||
Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.HeapSnapshotRepository _snapshots;
|
||||
late M.ObjectRepository _objects;
|
||||
SnapshotReader? _reader;
|
||||
String? _status;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.HeapSnapshotRepository _snapshots;
|
||||
M.ObjectRepository _objects;
|
||||
SnapshotReader _reader;
|
||||
String _status;
|
||||
List<SnapshotGraph> _loadedSnapshots = <SnapshotGraph>[];
|
||||
SnapshotGraph? _snapshotA;
|
||||
SnapshotGraph? _snapshotB;
|
||||
SnapshotGraph _snapshotA;
|
||||
SnapshotGraph _snapshotB;
|
||||
HeapSnapshotTreeMode _mode = HeapSnapshotTreeMode.mergedDominatorTreeMap;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
M.HeapSnapshotRepository get profiles => _snapshots;
|
||||
M.VMRef get vm => _vm;
|
||||
|
||||
List<SnapshotObject>? selection;
|
||||
SnapshotMergedDominator? mergedSelection;
|
||||
MergedDominatorDiff? mergedDiffSelection;
|
||||
List<SnapshotObject> selection;
|
||||
SnapshotMergedDominator mergedSelection;
|
||||
MergedDominatorDiff mergedDiffSelection;
|
||||
|
||||
factory HeapSnapshotElement(
|
||||
M.VM vm,
|
||||
|
@ -701,7 +701,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
M.NotificationRepository notifications,
|
||||
M.HeapSnapshotRepository snapshots,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -766,7 +766,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
if (_reader != null) {
|
||||
// Loading
|
||||
content.addAll(_createStatusMessage('Loading snapshot...',
|
||||
description: _status!, progress: 1));
|
||||
description: _status, progress: 1));
|
||||
} else if (_snapshotA != null) {
|
||||
// Loaded
|
||||
content.addAll(_createReport());
|
||||
|
@ -780,7 +780,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
_save() {
|
||||
var blob = new Blob(_snapshotA!.chunks, 'application/octet-stream');
|
||||
var blob = new Blob(_snapshotA.chunks, 'application/octet-stream');
|
||||
var blobUrl = Url.createObjectUrl(blob);
|
||||
var link = new AnchorElement();
|
||||
link.href = blobUrl;
|
||||
|
@ -794,13 +794,13 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
input.type = 'file';
|
||||
input.multiple = false;
|
||||
input.onChange.listen((event) {
|
||||
var file = input.files![0];
|
||||
var file = input.files[0];
|
||||
var reader = new FileReader();
|
||||
reader.onLoad.listen((event) async {
|
||||
var encoded = <Uint8List>[reader.result as Uint8List];
|
||||
var encoded = <Uint8List>[reader.result];
|
||||
var snapshotReader = new SnapshotReader();
|
||||
_snapshotLoading(snapshotReader);
|
||||
snapshotReader.add(reader.result as Uint8List);
|
||||
snapshotReader.add(reader.result);
|
||||
snapshotReader.close();
|
||||
});
|
||||
reader.readAsArrayBuffer(file);
|
||||
|
@ -854,7 +854,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
];
|
||||
}
|
||||
|
||||
VirtualTreeElement? _tree;
|
||||
VirtualTreeElement _tree;
|
||||
|
||||
void _createTreeMap<T>(List<HtmlElement> report, TreeMap<T> treemap, T root) {
|
||||
final content = new DivElement();
|
||||
|
@ -927,13 +927,13 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
switch (_mode) {
|
||||
case HeapSnapshotTreeMode.dominatorTree:
|
||||
if (selection == null) {
|
||||
selection = List.from(_snapshotA!.root.objects);
|
||||
selection = List.from(_snapshotA.root.objects);
|
||||
}
|
||||
_tree = new VirtualTreeElement(
|
||||
_createDominator, _updateDominator, _getChildrenDominator,
|
||||
items: selection!, queue: _r.queue);
|
||||
if (selection!.length == 1) {
|
||||
_tree!.expand(selection!.first);
|
||||
items: selection, queue: _r.queue);
|
||||
if (selection.length == 1) {
|
||||
_tree.expand(selection.first);
|
||||
}
|
||||
final text = 'In a heap dominator tree, an object X is a parent of '
|
||||
'object Y if every path from the root to Y goes through '
|
||||
|
@ -945,49 +945,49 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.dominatorTreeMap:
|
||||
if (selection == null) {
|
||||
selection = List.from(_snapshotA!.root.objects);
|
||||
selection = List.from(_snapshotA.root.objects);
|
||||
}
|
||||
_createTreeMap(report, new DominatorTreeMap(this), selection!.first);
|
||||
_createTreeMap(report, new DominatorTreeMap(this), selection.first);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.mergedDominatorTree:
|
||||
_tree = new VirtualTreeElement(_createMergedDominator,
|
||||
_updateMergedDominator, _getChildrenMergedDominator,
|
||||
items: _getChildrenMergedDominator(_snapshotA!.mergedRoot),
|
||||
items: _getChildrenMergedDominator(_snapshotA.mergedRoot),
|
||||
queue: _r.queue);
|
||||
_tree!.expand(_snapshotA!.mergedRoot);
|
||||
_tree.expand(_snapshotA.mergedRoot);
|
||||
final text = 'A heap dominator tree, where siblings with the same class'
|
||||
' have been merged into a single node.';
|
||||
report.addAll([
|
||||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.mergedDominatorTreeDiff:
|
||||
var root = MergedDominatorDiff.from(
|
||||
_snapshotA!.mergedRoot, _snapshotB!.mergedRoot);
|
||||
_snapshotA.mergedRoot, _snapshotB.mergedRoot);
|
||||
_tree = new VirtualTreeElement(_createMergedDominatorDiff,
|
||||
_updateMergedDominatorDiff, _getChildrenMergedDominatorDiff,
|
||||
items: _getChildrenMergedDominatorDiff(root), queue: _r.queue);
|
||||
_tree!.expand(root);
|
||||
_tree.expand(root);
|
||||
final text = 'A heap dominator tree, where siblings with the same class'
|
||||
' have been merged into a single node.';
|
||||
report.addAll([
|
||||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.mergedDominatorTreeMap:
|
||||
if (mergedSelection == null) {
|
||||
mergedSelection = _snapshotA!.mergedRoot;
|
||||
mergedSelection = _snapshotA.mergedRoot;
|
||||
}
|
||||
_createTreeMap(
|
||||
report, new MergedDominatorTreeMap(this), mergedSelection);
|
||||
|
@ -995,19 +995,18 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
case HeapSnapshotTreeMode.mergedDominatorTreeMapDiff:
|
||||
if (mergedDiffSelection == null) {
|
||||
mergedDiffSelection = MergedDominatorDiff.from(
|
||||
_snapshotA!.mergedRoot, _snapshotB!.mergedRoot);
|
||||
_snapshotA.mergedRoot, _snapshotB.mergedRoot);
|
||||
}
|
||||
_createTreeMap(
|
||||
report, new MergedDominatorDiffTreeMap(this), mergedDiffSelection);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.ownershipTable:
|
||||
final items =
|
||||
_snapshotA!.classes.where((c) => c.ownedSize > 0).toList();
|
||||
final items = _snapshotA.classes.where((c) => c.ownedSize > 0).toList();
|
||||
items.sort((a, b) => b.ownedSize - a.ownedSize);
|
||||
_tree = new VirtualTreeElement(
|
||||
_createOwnership, _updateOwnership, _getChildrenOwnership,
|
||||
items: items, queue: _r.queue);
|
||||
_tree!.expand(_snapshotA!.root);
|
||||
_tree.expand(_snapshotA.root);
|
||||
final text = 'An object X is said to "own" object Y if X is the only '
|
||||
'object that references Y, or X owns the only object that '
|
||||
'references Y. In particular, objects "own" the space of any '
|
||||
|
@ -1016,18 +1015,18 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.ownershipTableDiff:
|
||||
final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
|
||||
final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
|
||||
items.sort((a, b) => b.ownedSizeB - a.ownedSizeB);
|
||||
items.sort((a, b) => b.ownedSizeA - a.ownedSizeA);
|
||||
items.sort((a, b) => b.ownedSizeDiff - a.ownedSizeDiff);
|
||||
_tree = new VirtualTreeElement(_createOwnershipDiff,
|
||||
_updateOwnershipDiff, _getChildrenOwnershipDiff,
|
||||
items: items, queue: _r.queue);
|
||||
_tree!.expand(_snapshotA!.root);
|
||||
_tree.expand(_snapshotA.root);
|
||||
final text = 'An object X is said to "own" object Y if X is the only '
|
||||
'object that references Y, or X owns the only object that '
|
||||
'references Y. In particular, objects "own" the space of any '
|
||||
|
@ -1036,88 +1035,88 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.ownershipTreeMap:
|
||||
_createTreeMap(
|
||||
report, new ClassesOwnershipTreeMap(this, _snapshotA!), null);
|
||||
report, new ClassesOwnershipTreeMap(this, _snapshotA), null);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.ownershipTreeMapDiff:
|
||||
final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
|
||||
final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
|
||||
_createTreeMap(
|
||||
report, new ClassesOwnershipDiffTreeMap(this, items), null);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.successors:
|
||||
if (selection == null) {
|
||||
selection = List.from(_snapshotA!.root.objects);
|
||||
selection = List.from(_snapshotA.root.objects);
|
||||
}
|
||||
_tree = new VirtualTreeElement(
|
||||
_createSuccessor, _updateSuccessor, _getChildrenSuccessor,
|
||||
items: selection!, queue: _r.queue);
|
||||
if (selection!.length == 1) {
|
||||
_tree!.expand(selection!.first);
|
||||
items: selection, queue: _r.queue);
|
||||
if (selection.length == 1) {
|
||||
_tree.expand(selection.first);
|
||||
}
|
||||
final text = '';
|
||||
report.addAll([
|
||||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.predecessors:
|
||||
if (selection == null) {
|
||||
selection = List.from(_snapshotA!.root.objects);
|
||||
selection = List.from(_snapshotA.root.objects);
|
||||
}
|
||||
_tree = new VirtualTreeElement(
|
||||
_createPredecessor, _updatePredecessor, _getChildrenPredecessor,
|
||||
items: selection!, queue: _r.queue);
|
||||
if (selection!.length == 1) {
|
||||
_tree!.expand(selection!.first);
|
||||
items: selection, queue: _r.queue);
|
||||
if (selection.length == 1) {
|
||||
_tree.expand(selection.first);
|
||||
}
|
||||
final text = '';
|
||||
report.addAll([
|
||||
new DivElement()
|
||||
..classes = ['content-centered-big', 'explanation']
|
||||
..text = text,
|
||||
_tree!.element
|
||||
_tree.element
|
||||
]);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.classesTable:
|
||||
final items = _snapshotA!.classes.toList();
|
||||
final items = _snapshotA.classes.toList();
|
||||
items.sort((a, b) => b.shallowSize - a.shallowSize);
|
||||
_tree = new VirtualTreeElement(
|
||||
_createClass, _updateClass, _getChildrenClass,
|
||||
items: items, queue: _r.queue);
|
||||
report.add(_tree!.element);
|
||||
report.add(_tree.element);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.classesTableDiff:
|
||||
final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
|
||||
final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
|
||||
items.sort((a, b) => b.shallowSizeB - a.shallowSizeB);
|
||||
items.sort((a, b) => b.shallowSizeA - a.shallowSizeA);
|
||||
items.sort((a, b) => b.shallowSizeDiff - a.shallowSizeDiff);
|
||||
_tree = new VirtualTreeElement(
|
||||
_createClassDiff, _updateClassDiff, _getChildrenClassDiff,
|
||||
items: items, queue: _r.queue);
|
||||
report.add(_tree!.element);
|
||||
report.add(_tree.element);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.classesTreeMap:
|
||||
_createTreeMap(
|
||||
report, new ClassesShallowTreeMap(this, _snapshotA!), null);
|
||||
report, new ClassesShallowTreeMap(this, _snapshotA), null);
|
||||
break;
|
||||
|
||||
case HeapSnapshotTreeMode.classesTreeMapDiff:
|
||||
final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
|
||||
final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
|
||||
_createTreeMap(
|
||||
report, new ClassesShallowDiffTreeMap(this, items), null);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.process:
|
||||
_createTreeMap(
|
||||
report, new ProcessTreeMap(this, _snapshotA!), ProcessTreeMap.root);
|
||||
report, new ProcessTreeMap(this, _snapshotA), ProcessTreeMap.root);
|
||||
break;
|
||||
case HeapSnapshotTreeMode.processDiff:
|
||||
final root = PartitionDiff.from(_snapshotA!, _snapshotB!);
|
||||
final root = PartitionDiff.from(_snapshotA, _snapshotB);
|
||||
_createTreeMap(report, new ProcessDiffTreeMap(this), root);
|
||||
break;
|
||||
default:
|
||||
|
@ -1365,7 +1364,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
|
||||
static Iterable _getChildrenMergedDominatorDiff(nodeDynamic) {
|
||||
MergedDominatorDiff node = nodeDynamic;
|
||||
final list = node.children!
|
||||
final list = node.children
|
||||
.where((child) =>
|
||||
child.retainedSizeA >= kMinRetainedSize ||
|
||||
child.retainedSizeB >= kMinRetainedSize)
|
||||
|
@ -1393,11 +1392,11 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
void _updateDominator(HtmlElement element, nodeDynamic, int depth) {
|
||||
SnapshotObject node = nodeDynamic;
|
||||
element.children[0].text = Utils.formatPercentNormalized(
|
||||
node.retainedSize * 1.0 / _snapshotA!.size);
|
||||
node.retainedSize * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.retainedSize);
|
||||
_updateLines(element.children[2].children, depth);
|
||||
if (_getChildrenDominator(node).isNotEmpty) {
|
||||
element.children[3].text = _tree!.isExpanded(node) ? '▼' : '►';
|
||||
element.children[3].text = _tree.isExpanded(node) ? '▼' : '►';
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
|
@ -1423,7 +1422,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
SnapshotObject node = nodeDynamic;
|
||||
_updateLines(element.children[0].children, depth);
|
||||
if (_getChildrenSuccessor(node).isNotEmpty) {
|
||||
element.children[1].text = _tree!.isExpanded(node) ? '▼' : '►';
|
||||
element.children[1].text = _tree.isExpanded(node) ? '▼' : '►';
|
||||
} else {
|
||||
element.children[1].text = '';
|
||||
}
|
||||
|
@ -1451,7 +1450,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
SnapshotObject node = nodeDynamic;
|
||||
_updateLines(element.children[0].children, depth);
|
||||
if (_getChildrenSuccessor(node).isNotEmpty) {
|
||||
element.children[1].text = _tree!.isExpanded(node) ? '▼' : '►';
|
||||
element.children[1].text = _tree.isExpanded(node) ? '▼' : '►';
|
||||
} else {
|
||||
element.children[1].text = '';
|
||||
}
|
||||
|
@ -1478,11 +1477,11 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
void _updateMergedDominator(HtmlElement element, nodeDynamic, int depth) {
|
||||
SnapshotMergedDominator node = nodeDynamic;
|
||||
element.children[0].text = Utils.formatPercentNormalized(
|
||||
node.retainedSize * 1.0 / _snapshotA!.size);
|
||||
node.retainedSize * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.retainedSize);
|
||||
_updateLines(element.children[2].children, depth);
|
||||
if (_getChildrenMergedDominator(node).isNotEmpty) {
|
||||
element.children[3].text = _tree!.isExpanded(node) ? '▼' : '►';
|
||||
element.children[3].text = _tree.isExpanded(node) ? '▼' : '►';
|
||||
} else {
|
||||
element.children[3].text = '';
|
||||
}
|
||||
|
@ -1493,10 +1492,10 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
void _updateMergedDominatorDiff(HtmlElement element, nodeDynamic, int depth) {
|
||||
MergedDominatorDiff node = nodeDynamic;
|
||||
element.children[0].text = Utils.formatPercentNormalized(
|
||||
node.retainedSizeA * 1.0 / _snapshotA!.size);
|
||||
node.retainedSizeA * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.retainedSizeA);
|
||||
element.children[2].text = Utils.formatPercentNormalized(
|
||||
node.retainedSizeB * 1.0 / _snapshotB!.size);
|
||||
node.retainedSizeB * 1.0 / _snapshotB.size);
|
||||
element.children[3].text = Utils.formatSize(node.retainedSizeB);
|
||||
element.children[4].text = (node.retainedSizeDiff > 0 ? '+' : '') +
|
||||
Utils.formatSize(node.retainedSizeDiff);
|
||||
|
@ -1504,7 +1503,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
node.retainedSizeDiff > 0 ? "red" : "green";
|
||||
_updateLines(element.children[5].children, depth);
|
||||
if (_getChildrenMergedDominatorDiff(node).isNotEmpty) {
|
||||
element.children[6].text = _tree!.isExpanded(node) ? '▼' : '►';
|
||||
element.children[6].text = _tree.isExpanded(node) ? '▼' : '►';
|
||||
} else {
|
||||
element.children[6].text = '';
|
||||
}
|
||||
|
@ -1516,7 +1515,7 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
void _updateOwnership(HtmlElement element, nodeDynamic, int depth) {
|
||||
SnapshotClass node = nodeDynamic;
|
||||
element.children[0].text =
|
||||
Utils.formatPercentNormalized(node.ownedSize * 1.0 / _snapshotA!.size);
|
||||
Utils.formatPercentNormalized(node.ownedSize * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.ownedSize);
|
||||
element.children[2].text = node.name;
|
||||
}
|
||||
|
@ -1524,10 +1523,10 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
void _updateOwnershipDiff(HtmlElement element, nodeDynamic, int depth) {
|
||||
SnapshotClassDiff node = nodeDynamic;
|
||||
element.children[0].text =
|
||||
Utils.formatPercentNormalized(node.ownedSizeA * 1.0 / _snapshotA!.size);
|
||||
Utils.formatPercentNormalized(node.ownedSizeA * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.ownedSizeA);
|
||||
element.children[2].text =
|
||||
Utils.formatPercentNormalized(node.ownedSizeB * 1.0 / _snapshotB!.size);
|
||||
Utils.formatPercentNormalized(node.ownedSizeB * 1.0 / _snapshotB.size);
|
||||
element.children[3].text = Utils.formatSize(node.ownedSizeB);
|
||||
element.children[4].text = (node.ownedSizeDiff > 0 ? "+" : "") +
|
||||
Utils.formatSize(node.ownedSizeDiff);
|
||||
|
@ -1537,8 +1536,8 @@ class HeapSnapshotElement extends CustomElement implements Renderable {
|
|||
|
||||
void _updateClass(HtmlElement element, nodeDynamic, int depth) {
|
||||
SnapshotClass node = nodeDynamic;
|
||||
element.children[0].text = Utils.formatPercentNormalized(
|
||||
node.shallowSize * 1.0 / _snapshotA!.size);
|
||||
element.children[0].text =
|
||||
Utils.formatPercentNormalized(node.shallowSize * 1.0 / _snapshotA.size);
|
||||
element.children[1].text = Utils.formatSize(node.shallowSize);
|
||||
element.children[2].text = node.instanceCount.toString();
|
||||
element.children[3].text = node.name;
|
||||
|
|
|
@ -28,7 +28,7 @@ import 'package:observatory/src/elements/unknown_ref.dart';
|
|||
import 'package:observatory/src/elements/unlinkedcall_ref.dart';
|
||||
|
||||
Element anyRef(M.IsolateRef isolate, ref, M.ObjectRepository objects,
|
||||
{RenderingQueue? queue, bool expandable: true}) {
|
||||
{RenderingQueue queue, bool expandable: true}) {
|
||||
if (ref == null) {
|
||||
return new SpanElement()..text = "???";
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'dart:html';
|
||||
|
||||
Element navBar(List<Element> content) {
|
||||
Element navBar(Iterable<Element> content) {
|
||||
assert(content != null);
|
||||
return document.createElement('nav')
|
||||
..classes = ['nav-bar']
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'dart:html';
|
||||
|
||||
navMenu(String label, {String? link, List<Element> content: const []}) {
|
||||
navMenu(String label, {String link, Iterable<Element> content: const []}) {
|
||||
assert(label != null);
|
||||
assert(content != null);
|
||||
return new LIElement()
|
||||
|
|
|
@ -54,7 +54,7 @@ class RenderingScheduler<T extends Renderable> implements RenderingTask {
|
|||
|
||||
/// Creates a new scheduler for an element.
|
||||
/// If no queue is provided it will create a new default configured queue.
|
||||
factory RenderingScheduler(T element, {RenderingQueue? queue}) {
|
||||
factory RenderingScheduler(T element, {RenderingQueue queue}) {
|
||||
assert(element != null);
|
||||
if (queue == null) {
|
||||
queue = new RenderingQueue();
|
||||
|
|
|
@ -9,8 +9,7 @@ HtmlElement element(CustomElement e) => e.element;
|
|||
|
||||
class CustomElement {
|
||||
static Expando reverseElements = new Expando();
|
||||
static CustomElement reverse(HtmlElement element) =>
|
||||
reverseElements[element] as CustomElement;
|
||||
static CustomElement reverse(HtmlElement element) => reverseElements[element];
|
||||
|
||||
static List<CustomElement> toBeAttached = <CustomElement>[];
|
||||
static void drainAttached() {
|
||||
|
@ -47,8 +46,7 @@ class CustomElement {
|
|||
}
|
||||
|
||||
final HtmlElement element;
|
||||
CustomElement.created(Tag tag)
|
||||
: element = document.createElement("shadow") as HtmlElement {
|
||||
CustomElement.created(Tag tag) : element = document.createElement("shadow") {
|
||||
reverseElements[element] = this;
|
||||
element.classes = [tag.name];
|
||||
|
||||
|
@ -61,7 +59,7 @@ class CustomElement {
|
|||
void attached() {}
|
||||
void detached() {}
|
||||
|
||||
Element? get parent => element.parent;
|
||||
Element get parent => element.parent;
|
||||
|
||||
List<Element> get children => element.children;
|
||||
set children(List<Element> c) => element.children = c;
|
||||
|
@ -72,7 +70,7 @@ class CustomElement {
|
|||
String get title => element.title;
|
||||
set title(String t) => element.title = t;
|
||||
|
||||
String? get text => element.text;
|
||||
String get text => element.text;
|
||||
set text(String t) => element.text = t;
|
||||
|
||||
CssStyleDeclaration get style => element.style;
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:observatory/models.dart' as M;
|
|||
/// Utility class for URIs generation.
|
||||
abstract class Uris {
|
||||
static String _isolatePage(String path, M.IsolateRef isolate,
|
||||
{M.ObjectRef? object}) {
|
||||
{M.ObjectRef object}) {
|
||||
final parameters = {'isolateId': isolate.id};
|
||||
if (object != null) parameters['objectId'] = object.id;
|
||||
return '#' + new Uri(path: path, queryParameters: parameters).toString();
|
||||
|
@ -28,7 +28,7 @@ abstract class Uris {
|
|||
_isolatePage('/heap-map', isolate);
|
||||
static String heapSnapshot(M.IsolateRef isolate) =>
|
||||
_isolatePage('/heap-snapshot', isolate);
|
||||
static String inspect(M.IsolateRef isolate, {M.ObjectRef? object, int? pos}) {
|
||||
static String inspect(M.IsolateRef isolate, {M.ObjectRef object, int pos}) {
|
||||
if (pos == null) {
|
||||
return _isolatePage('/inspect', isolate, object: object);
|
||||
}
|
||||
|
|
|
@ -12,18 +12,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class ICDataRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<ICDataRefElement>('icdata-ref');
|
||||
|
||||
late RenderingScheduler<ICDataRefElement> _r;
|
||||
RenderingScheduler<ICDataRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ICDataRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ICDataRef _icdata;
|
||||
M.IsolateRef _isolate;
|
||||
M.ICDataRef _icdata;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.ICDataRef get icdata => _icdata;
|
||||
|
||||
factory ICDataRefElement(M.IsolateRef isolate, M.ICDataRef icdata,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(icdata != null);
|
||||
ICDataRefElement e = new ICDataRefElement.created();
|
||||
|
|
|
@ -32,21 +32,21 @@ class ICDataViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ICDataViewElement> _r;
|
||||
RenderingScheduler<ICDataViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ICDataViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.ICData _icdata;
|
||||
late M.ICDataRepository _icdatas;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.ICData _icdata;
|
||||
M.ICDataRepository _icdatas;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -65,7 +65,7 @@ class ICDataViewElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -118,7 +118,7 @@ class ICDataViewElement extends CustomElement implements Renderable {
|
|||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
_icdata = await _icdatas.get(_isolate, _icdata.id!);
|
||||
_icdata = await _icdatas.get(_isolate, _icdata.id);
|
||||
_r.dirty();
|
||||
}))
|
||||
.element,
|
||||
|
|
|
@ -15,16 +15,16 @@ class InboundReferencesElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<InboundReferencesElement>('inbound-references',
|
||||
dependencies: const [CurlyBlockElement.tag, InstanceRefElement.tag]);
|
||||
|
||||
late RenderingScheduler<InboundReferencesElement> _r;
|
||||
RenderingScheduler<InboundReferencesElement> _r;
|
||||
|
||||
Stream<RenderedEvent<InboundReferencesElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ObjectRef _object;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.ObjectRepository _objects;
|
||||
M.InboundReferences? _inbounds;
|
||||
M.IsolateRef _isolate;
|
||||
M.ObjectRef _object;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.ObjectRepository _objects;
|
||||
M.InboundReferences _inbounds;
|
||||
bool _expanded = false;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -32,7 +32,7 @@ class InboundReferencesElement extends CustomElement implements Renderable {
|
|||
|
||||
factory InboundReferencesElement(M.IsolateRef isolate, M.ObjectRef object,
|
||||
M.InboundReferencesRepository references, M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(object != null);
|
||||
assert(references != null);
|
||||
|
@ -78,7 +78,7 @@ class InboundReferencesElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_inbounds = await _references.get(_isolate, _object.id!);
|
||||
_inbounds = await _references.get(_isolate, _object.id);
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class InboundReferencesElement extends CustomElement implements Renderable {
|
|||
if (_inbounds == null) {
|
||||
return const [];
|
||||
}
|
||||
return _inbounds!.elements.map<Element>(_createItem).toList();
|
||||
return _inbounds.elements.map<Element>(_createItem).toList();
|
||||
}
|
||||
|
||||
Element _createItem(M.InboundReference reference) {
|
||||
|
|
|
@ -17,23 +17,23 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<InstanceRefElement>('instance-ref',
|
||||
dependencies: const [CurlyBlockElement.tag]);
|
||||
|
||||
late RenderingScheduler<InstanceRefElement> _r;
|
||||
RenderingScheduler<InstanceRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<InstanceRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.InstanceRef _instance;
|
||||
late M.ObjectRepository _objects;
|
||||
M.Instance? _loadedInstance;
|
||||
late bool _expandable;
|
||||
late bool _expanded = false;
|
||||
M.IsolateRef _isolate;
|
||||
M.InstanceRef _instance;
|
||||
M.ObjectRepository _objects;
|
||||
M.Instance _loadedInstance;
|
||||
bool _expandable;
|
||||
bool _expanded = false;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.InstanceRef get instance => _instance;
|
||||
|
||||
factory InstanceRefElement(
|
||||
M.IsolateRef isolate, M.InstanceRef instance, M.ObjectRepository objects,
|
||||
{RenderingQueue? queue, bool expandable: true}) {
|
||||
{RenderingQueue queue, bool expandable: true}) {
|
||||
assert(isolate != null);
|
||||
assert(instance != null);
|
||||
assert(objects != null);
|
||||
|
@ -89,20 +89,19 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_loadedInstance = await _objects.get(_isolate, _instance.id!) as M.Instance;
|
||||
_loadedInstance = await _objects.get(_isolate, _instance.id);
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
List<Element> _createShowMoreButton() {
|
||||
if (_loadedInstance!.count == null) {
|
||||
if (_loadedInstance.count == null) {
|
||||
return [];
|
||||
}
|
||||
final count = _loadedInstance!.count;
|
||||
final count = _loadedInstance.count;
|
||||
final button = new ButtonElement()..text = 'show next ${count}';
|
||||
button.onClick.listen((_) async {
|
||||
button.disabled = true;
|
||||
_loadedInstance =
|
||||
await _objects.get(_isolate, _instance.id!) as M.Instance;
|
||||
_loadedInstance = await _objects.get(_isolate, _instance.id);
|
||||
_r.dirty();
|
||||
});
|
||||
return [button];
|
||||
|
@ -125,7 +124,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
return [
|
||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||
..text = Utils.formatStringAsLiteral(
|
||||
_instance.valueAsString!, _instance.valueAsStringIsTruncated!)
|
||||
_instance.valueAsString, _instance.valueAsStringIsTruncated)
|
||||
];
|
||||
case M.InstanceKind.type:
|
||||
case M.InstanceKind.typeRef:
|
||||
|
@ -141,7 +140,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
new SpanElement()
|
||||
..classes = ['emphasize']
|
||||
..text = 'Closure',
|
||||
new SpanElement()..text = ' (${_instance.closureFunction!.name})'
|
||||
new SpanElement()..text = ' (${_instance.closureFunction.name})'
|
||||
]
|
||||
];
|
||||
case M.InstanceKind.regExp:
|
||||
|
@ -150,8 +149,8 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
new SpanElement()
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name,
|
||||
new SpanElement()..text = ' (${_instance.pattern!.valueAsString})'
|
||||
..text = _instance.clazz.name,
|
||||
new SpanElement()..text = ' (${_instance.pattern.valueAsString})'
|
||||
]
|
||||
];
|
||||
case M.InstanceKind.stackTrace:
|
||||
|
@ -160,14 +159,14 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
new SpanElement()
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name,
|
||||
..text = _instance.clazz.name,
|
||||
]
|
||||
];
|
||||
case M.InstanceKind.plainInstance:
|
||||
return [
|
||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name
|
||||
..text = _instance.clazz.name
|
||||
];
|
||||
case M.InstanceKind.list:
|
||||
case M.InstanceKind.map:
|
||||
|
@ -190,7 +189,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
new SpanElement()
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name,
|
||||
..text = _instance.clazz.name,
|
||||
new SpanElement()..text = ' (${_instance.length})'
|
||||
]
|
||||
];
|
||||
|
@ -198,13 +197,13 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
return [
|
||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name
|
||||
..text = _instance.clazz.name
|
||||
];
|
||||
case M.InstanceKind.weakProperty:
|
||||
return [
|
||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||
..classes = ['emphasize']
|
||||
..text = _instance.clazz!.name
|
||||
..text = _instance.clazz.name
|
||||
];
|
||||
}
|
||||
throw new Exception('Unknown InstanceKind: ${_instance.kind}');
|
||||
|
@ -234,7 +233,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
case M.InstanceKind.int32x4List:
|
||||
case M.InstanceKind.float32x4List:
|
||||
case M.InstanceKind.float64x2List:
|
||||
return _instance.length! > 0;
|
||||
return _instance.length > 0;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -248,30 +247,29 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
case M.InstanceKind.closure:
|
||||
{
|
||||
var members = <Element>[];
|
||||
if (_loadedInstance!.closureFunction != null) {
|
||||
if (_loadedInstance.closureFunction != null) {
|
||||
members.add(new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'function = ',
|
||||
anyRef(_isolate, _loadedInstance!.closureFunction, _objects,
|
||||
anyRef(_isolate, _loadedInstance.closureFunction, _objects,
|
||||
queue: _r.queue)
|
||||
]);
|
||||
}
|
||||
if (_loadedInstance!.closureContext != null) {
|
||||
if (_loadedInstance.closureContext != null) {
|
||||
members.add(new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'context = ',
|
||||
anyRef(_isolate, _loadedInstance!.closureContext, _objects,
|
||||
anyRef(_isolate, _loadedInstance.closureContext, _objects,
|
||||
queue: _r.queue)
|
||||
]);
|
||||
}
|
||||
return members;
|
||||
}
|
||||
case M.InstanceKind.plainInstance:
|
||||
return _loadedInstance!.fields!
|
||||
return _loadedInstance.fields
|
||||
.map<Element>((f) => new DivElement()
|
||||
..children = <Element>[
|
||||
new FieldRefElement(_isolate, f.decl!, _objects,
|
||||
queue: _r.queue)
|
||||
new FieldRefElement(_isolate, f.decl, _objects, queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ' = ',
|
||||
anyRef(_isolate, f.value, _objects, queue: _r.queue)
|
||||
|
@ -279,7 +277,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
.toList();
|
||||
case M.InstanceKind.list:
|
||||
var index = 0;
|
||||
return _loadedInstance!.elements!
|
||||
return _loadedInstance.elements
|
||||
.map<Element>((element) => new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = '[ ${index++} ] : ',
|
||||
|
@ -288,7 +286,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
.toList()
|
||||
..addAll(_createShowMoreButton());
|
||||
case M.InstanceKind.map:
|
||||
return _loadedInstance!.associations!
|
||||
return _loadedInstance.associations
|
||||
.map<Element>((association) => new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = '[ ',
|
||||
|
@ -313,14 +311,14 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
case M.InstanceKind.float32x4List:
|
||||
case M.InstanceKind.float64x2List:
|
||||
var index = 0;
|
||||
return _loadedInstance!.typedElements!
|
||||
return _loadedInstance.typedElements
|
||||
.map<Element>((e) => new DivElement()..text = '[ ${index++} ] : $e')
|
||||
.toList()
|
||||
..addAll(_createShowMoreButton());
|
||||
case M.InstanceKind.mirrorReference:
|
||||
return [
|
||||
new SpanElement()..text = '<referent> : ',
|
||||
anyRef(_isolate, _loadedInstance!.referent, _objects, queue: _r.queue)
|
||||
anyRef(_isolate, _loadedInstance.referent, _objects, queue: _r.queue)
|
||||
];
|
||||
case M.InstanceKind.stackTrace:
|
||||
return [
|
||||
|
@ -331,12 +329,12 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
|||
case M.InstanceKind.weakProperty:
|
||||
return [
|
||||
new SpanElement()..text = '<key> : ',
|
||||
new InstanceRefElement(_isolate, _loadedInstance!.key!, _objects,
|
||||
new InstanceRefElement(_isolate, _loadedInstance.key, _objects,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new BRElement(),
|
||||
new SpanElement()..text = '<value> : ',
|
||||
new InstanceRefElement(_isolate, _loadedInstance!.value!, _objects,
|
||||
new InstanceRefElement(_isolate, _loadedInstance.value, _objects,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
];
|
||||
|
|
|
@ -54,29 +54,29 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<InstanceViewElement> _r;
|
||||
RenderingScheduler<InstanceViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<InstanceViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Instance _instance;
|
||||
M.LibraryRef? _library;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.ClassRepository _classes;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.EvalRepository _eval;
|
||||
M.TypeArguments? _typeArguments;
|
||||
late M.TypeArgumentsRepository _arguments;
|
||||
late M.BreakpointRepository _breakpoints;
|
||||
late M.FunctionRepository _functions;
|
||||
M.SourceLocation? _location;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Instance _instance;
|
||||
M.LibraryRef _library;
|
||||
M.ObjectRepository _objects;
|
||||
M.ClassRepository _classes;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ScriptRepository _scripts;
|
||||
M.EvalRepository _eval;
|
||||
M.TypeArguments _typeArguments;
|
||||
M.TypeArgumentsRepository _arguments;
|
||||
M.BreakpointRepository _breakpoints;
|
||||
M.FunctionRepository _functions;
|
||||
M.SourceLocation _location;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -100,7 +100,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
M.TypeArgumentsRepository arguments,
|
||||
M.BreakpointRepository breakpoints,
|
||||
M.FunctionRepository functions,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -159,7 +159,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
new HeadingElement.h2()
|
||||
..text = M.isAbstractType(_instance.kind)
|
||||
? 'type ${_instance.name}'
|
||||
: 'instance of ${_instance.clazz!.name}',
|
||||
: 'instance of ${_instance.clazz.name}',
|
||||
new HRElement(),
|
||||
new ObjectCommonElement(_isolate, _instance, _retainedSizes,
|
||||
_reachableSizes, _references, _retainingPaths, _objects,
|
||||
|
@ -178,8 +178,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
if (_location != null) {
|
||||
content.addAll([
|
||||
new HRElement(),
|
||||
new SourceInsetElement(
|
||||
_isolate, _location!, _scripts, _objects, _events,
|
||||
new SourceInsetElement(_isolate, _location, _scripts, _objects, _events,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]);
|
||||
|
@ -201,11 +200,11 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
|
||||
];
|
||||
if (_library != null) {
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
|
||||
menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
|
||||
.element);
|
||||
}
|
||||
menu.addAll(<Element>[
|
||||
new NavClassMenuElement(_isolate, _instance.clazz!, queue: _r.queue)
|
||||
new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue)
|
||||
.element,
|
||||
navMenu('instance'),
|
||||
(new NavRefreshElement(queue: _r.queue)
|
||||
|
@ -246,8 +245,8 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
if (_instance.kind == M.InstanceKind.string) {
|
||||
members.add(member(
|
||||
'value as literal',
|
||||
Utils.formatStringAsLiteral(_instance.valueAsString!,
|
||||
_instance.valueAsStringIsTruncated!)));
|
||||
Utils.formatStringAsLiteral(
|
||||
_instance.valueAsString, _instance.valueAsStringIsTruncated)));
|
||||
} else {
|
||||
members.add(member('value', _instance.valueAsString));
|
||||
}
|
||||
|
@ -255,7 +254,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
if (_instance.typeClass != null) {
|
||||
members.add(member('type class', _instance.typeClass));
|
||||
}
|
||||
if (_typeArguments != null && _typeArguments!.types!.isNotEmpty) {
|
||||
if (_typeArguments != null && _typeArguments.types.isNotEmpty) {
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -265,7 +264,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = ([new SpanElement()..text = '< ']
|
||||
..addAll(_typeArguments!.types!.expand((type) => [
|
||||
..addAll(_typeArguments.types.expand((type) => [
|
||||
new InstanceRefElement(_isolate, type, _objects,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
|
@ -294,7 +293,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
members.add(member('closure context', _instance.closureContext));
|
||||
}
|
||||
if (_instance.kind == M.InstanceKind.closure) {
|
||||
late ButtonElement btn;
|
||||
ButtonElement btn;
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -316,24 +315,24 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
}
|
||||
|
||||
if (_instance.nativeFields != null && _instance.nativeFields!.isNotEmpty) {
|
||||
if (_instance.nativeFields != null && _instance.nativeFields.isNotEmpty) {
|
||||
int i = 0;
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..text = 'native fields (${_instance.nativeFields!.length})',
|
||||
..text = 'native fields (${_instance.nativeFields.length})',
|
||||
new DivElement()
|
||||
..classes = ['memberName']
|
||||
..children = <Element>[
|
||||
(new CurlyBlockElement(
|
||||
expanded: _instance.nativeFields!.length <= 100,
|
||||
expanded: _instance.nativeFields.length <= 100,
|
||||
queue: _r.queue)
|
||||
..content = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _instance.nativeFields!
|
||||
..children = _instance.nativeFields
|
||||
.map<Element>(
|
||||
(f) => member('[ ${i++} ]', '[ ${f.value} ]'))
|
||||
.toList()
|
||||
|
@ -343,8 +342,8 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
}
|
||||
|
||||
if (_instance.fields != null && _instance.fields!.isNotEmpty) {
|
||||
final fields = _instance.fields!.toList();
|
||||
if (_instance.fields != null && _instance.fields.isNotEmpty) {
|
||||
final fields = _instance.fields.toList();
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -368,8 +367,8 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
}
|
||||
|
||||
if (_instance.elements != null && _instance.elements!.isNotEmpty) {
|
||||
final elements = _instance.elements!.toList();
|
||||
if (_instance.elements != null && _instance.elements.isNotEmpty) {
|
||||
final elements = _instance.elements.toList();
|
||||
int i = 0;
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -395,12 +394,12 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
if (_instance.length != elements.length) {
|
||||
members.add(member(
|
||||
'...', '${_instance.length! - elements.length} omitted elements'));
|
||||
'...', '${_instance.length - elements.length} omitted elements'));
|
||||
}
|
||||
}
|
||||
|
||||
if (_instance.associations != null && _instance.associations!.isNotEmpty) {
|
||||
final associations = _instance.associations!.toList();
|
||||
if (_instance.associations != null && _instance.associations.isNotEmpty) {
|
||||
final associations = _instance.associations.toList();
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -441,13 +440,12 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
if (_instance.length != associations.length) {
|
||||
members.add(member('...',
|
||||
'${_instance.length! - associations.length} omitted elements'));
|
||||
'${_instance.length - associations.length} omitted elements'));
|
||||
}
|
||||
}
|
||||
|
||||
if (_instance.typedElements != null &&
|
||||
_instance.typedElements!.isNotEmpty) {
|
||||
final typedElements = _instance.typedElements!.toList();
|
||||
if (_instance.typedElements != null && _instance.typedElements.isNotEmpty) {
|
||||
final typedElements = _instance.typedElements.toList();
|
||||
int i = 0;
|
||||
members.add(new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -472,15 +470,15 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
]);
|
||||
if (_instance.length != typedElements.length) {
|
||||
members.add(member('...',
|
||||
'${_instance.length! - typedElements.length} omitted elements'));
|
||||
'${_instance.length - typedElements.length} omitted elements'));
|
||||
}
|
||||
}
|
||||
|
||||
if (_instance.kind == M.InstanceKind.regExp) {
|
||||
members.add(member('pattern', _instance.pattern));
|
||||
members.add(
|
||||
member('isCaseSensitive', _instance.isCaseSensitive! ? 'yes' : 'no'));
|
||||
members.add(member('isMultiLine', _instance.isMultiLine! ? 'yes' : 'no'));
|
||||
member('isCaseSensitive', _instance.isCaseSensitive ? 'yes' : 'no'));
|
||||
members.add(member('isMultiLine', _instance.isMultiLine ? 'yes' : 'no'));
|
||||
if (_instance.oneByteFunction != null) {
|
||||
members.add(member('oneByteFunction', _instance.oneByteFunction));
|
||||
}
|
||||
|
@ -516,26 +514,25 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_instance = await _objects.get(_isolate, _instance.id!) as M.Instance;
|
||||
_instance = await _objects.get(_isolate, _instance.id);
|
||||
await _loadExtraData();
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
Future _loadExtraData() async {
|
||||
_library = (await _classes.get(_isolate, _instance.clazz!.id!)).library!;
|
||||
_library = (await _classes.get(_isolate, _instance.clazz.id)).library;
|
||||
if (_instance.typeArguments != null) {
|
||||
_typeArguments =
|
||||
await _arguments.get(_isolate, _instance.typeArguments!.id!);
|
||||
await _arguments.get(_isolate, _instance.typeArguments.id);
|
||||
} else {
|
||||
_typeArguments = null;
|
||||
}
|
||||
if (_instance.closureFunction != null) {
|
||||
_location =
|
||||
(await _functions.get(_isolate, _instance.closureFunction!.id!))
|
||||
.location;
|
||||
_location = (await _functions.get(_isolate, _instance.closureFunction.id))
|
||||
.location;
|
||||
} else if (_instance.typeClass != null) {
|
||||
_location =
|
||||
(await _classes.get(_isolate, _instance.typeClass!.id!)).location;
|
||||
(await _classes.get(_isolate, _instance.typeClass.id)).location;
|
||||
}
|
||||
_r.dirty();
|
||||
}
|
||||
|
@ -544,7 +541,7 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
|||
if (_instance.activationBreakpoint == null) {
|
||||
await _breakpoints.addOnActivation(_isolate, _instance);
|
||||
} else {
|
||||
await _breakpoints.remove(_isolate, _instance.activationBreakpoint!);
|
||||
await _breakpoints.remove(_isolate, _instance.activationBreakpoint);
|
||||
}
|
||||
await _refresh();
|
||||
}
|
||||
|
|
|
@ -11,15 +11,15 @@ class IsolateCounterChartElement extends CustomElement implements Renderable {
|
|||
static const tag =
|
||||
const Tag<IsolateCounterChartElement>('isolate-counter-chart');
|
||||
|
||||
late RenderingScheduler<IsolateCounterChartElement> _r;
|
||||
RenderingScheduler<IsolateCounterChartElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateCounterChartElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late Map _counters;
|
||||
late StreamSubscription _subscription;
|
||||
Map _counters;
|
||||
StreamSubscription _subscription;
|
||||
|
||||
factory IsolateCounterChartElement(Map counters, {RenderingQueue? queue}) {
|
||||
factory IsolateCounterChartElement(Map counters, {RenderingQueue queue}) {
|
||||
assert(counters != null);
|
||||
IsolateCounterChartElement e = new IsolateCounterChartElement.created();
|
||||
e._r = new RenderingScheduler<IsolateCounterChartElement>(e, queue: queue);
|
||||
|
|
|
@ -14,19 +14,19 @@ class IsolateLocationElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<IsolateLocationElement>('isolate-location',
|
||||
dependencies: const [FunctionRefElement.tag, SourceLinkElement.tag]);
|
||||
|
||||
late RenderingScheduler<IsolateLocationElement> _r;
|
||||
RenderingScheduler<IsolateLocationElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateLocationElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.Isolate _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.ScriptRepository _scripts;
|
||||
late StreamSubscription _debugSubscription;
|
||||
late StreamSubscription _isolateSubscription;
|
||||
M.Isolate _isolate;
|
||||
M.EventRepository _events;
|
||||
M.ScriptRepository _scripts;
|
||||
StreamSubscription _debugSubscription;
|
||||
StreamSubscription _isolateSubscription;
|
||||
|
||||
factory IsolateLocationElement(
|
||||
M.Isolate isolate, M.EventRepository events, M.ScriptRepository scripts,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
assert(scripts != null);
|
||||
|
@ -66,12 +66,12 @@ class IsolateLocationElement extends CustomElement implements Renderable {
|
|||
children = <Element>[
|
||||
new SpanElement()..text = 'at ',
|
||||
new FunctionRefElement(
|
||||
_isolate, M.topFrame(_isolate.pauseEvent)!.function!,
|
||||
_isolate, M.topFrame(_isolate.pauseEvent).function,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ' (',
|
||||
new SourceLinkElement(_isolate,
|
||||
M.topFrame(_isolate.pauseEvent)!.location!, _scripts,
|
||||
new SourceLinkElement(
|
||||
_isolate, M.topFrame(_isolate.pauseEvent).location, _scripts,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ') '
|
||||
|
@ -95,12 +95,12 @@ class IsolateLocationElement extends CustomElement implements Renderable {
|
|||
content.addAll([
|
||||
new SpanElement()..text = ' at ',
|
||||
new FunctionRefElement(
|
||||
_isolate, M.topFrame(_isolate.pauseEvent)!.function!,
|
||||
_isolate, M.topFrame(_isolate.pauseEvent).function,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ' (',
|
||||
new SourceLinkElement(_isolate,
|
||||
M.topFrame(_isolate.pauseEvent)!.location!, _scripts,
|
||||
M.topFrame(_isolate.pauseEvent).location, _scripts,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ') '
|
||||
|
|
|
@ -11,17 +11,17 @@ import 'package:observatory/src/elements/helpers/tag.dart';
|
|||
class IsolateRunStateElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<IsolateRunStateElement>('isolate-run-state');
|
||||
|
||||
late RenderingScheduler<IsolateRunStateElement> _r;
|
||||
RenderingScheduler<IsolateRunStateElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateRunStateElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.Isolate _isolate;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _debugSubscription;
|
||||
late StreamSubscription _isolateSubscription;
|
||||
M.Isolate _isolate;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _debugSubscription;
|
||||
StreamSubscription _isolateSubscription;
|
||||
|
||||
factory IsolateRunStateElement(M.Isolate isolate, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
IsolateRunStateElement e = new IsolateRunStateElement.created();
|
||||
|
@ -64,7 +64,7 @@ class IsolateRunStateElement extends CustomElement implements Renderable {
|
|||
case M.IsolateStatus.paused:
|
||||
children = <Element>[
|
||||
new SpanElement()
|
||||
..title = '${_isolate.pauseEvent!.timestamp}'
|
||||
..title = '${_isolate.pauseEvent.timestamp}'
|
||||
..text = 'paused '
|
||||
];
|
||||
break;
|
||||
|
|
|
@ -16,18 +16,18 @@ class IsolateSharedSummaryElement extends CustomElement implements Renderable {
|
|||
'isolate-shared-summary',
|
||||
dependencies: const [IsolateCounterChartElement.tag]);
|
||||
|
||||
late RenderingScheduler<IsolateSharedSummaryElement> _r;
|
||||
RenderingScheduler<IsolateSharedSummaryElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateSharedSummaryElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.Isolate _isolate;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _isolateSubscription;
|
||||
M.Isolate _isolate;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _isolateSubscription;
|
||||
|
||||
factory IsolateSharedSummaryElement(
|
||||
M.Isolate isolate, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
IsolateSharedSummaryElement e = new IsolateSharedSummaryElement.created();
|
||||
|
@ -55,10 +55,10 @@ class IsolateSharedSummaryElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void render() {
|
||||
final newHeapUsed = Utils.formatSize(_isolate.newSpace!.used);
|
||||
final newHeapCapacity = Utils.formatSize(_isolate.newSpace!.capacity);
|
||||
final oldHeapUsed = Utils.formatSize(_isolate.oldSpace!.used);
|
||||
final oldHeapCapacity = Utils.formatSize(_isolate.oldSpace!.capacity);
|
||||
final newHeapUsed = Utils.formatSize(_isolate.newSpace.used);
|
||||
final newHeapCapacity = Utils.formatSize(_isolate.newSpace.capacity);
|
||||
final oldHeapUsed = Utils.formatSize(_isolate.oldSpace.used);
|
||||
final oldHeapCapacity = Utils.formatSize(_isolate.oldSpace.capacity);
|
||||
final content = <Element>[
|
||||
new DivElement()
|
||||
..classes = ['menu']
|
||||
|
@ -151,14 +151,13 @@ class IsolateSharedSummaryElement extends CustomElement implements Renderable {
|
|||
new AnchorElement(href: Uris.logging(_isolate))..text = 'logging'
|
||||
]
|
||||
],
|
||||
new IsolateCounterChartElement(_isolate.counters!, queue: _r.queue)
|
||||
.element
|
||||
new IsolateCounterChartElement(_isolate.counters, queue: _r.queue).element
|
||||
];
|
||||
if (_isolate.error != null) {
|
||||
children = <Element>[
|
||||
new PreElement()
|
||||
..classes = ['errorBox']
|
||||
..text = _isolate.error!.message,
|
||||
..text = _isolate.error.message,
|
||||
new DivElement()
|
||||
..classes = ['summary']
|
||||
..children = content
|
||||
|
|
|
@ -23,22 +23,22 @@ class IsolateSummaryElement extends CustomElement implements Renderable {
|
|||
IsolateSharedSummaryElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<IsolateSummaryElement> _r;
|
||||
RenderingScheduler<IsolateSummaryElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateSummaryElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.IsolateRepository _isolates;
|
||||
late M.ScriptRepository _scripts;
|
||||
M.Isolate? _loadedIsolate;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.IsolateRepository _isolates;
|
||||
M.ScriptRepository _scripts;
|
||||
M.Isolate _loadedIsolate;
|
||||
|
||||
factory IsolateSummaryElement(
|
||||
M.IsolateRef isolate,
|
||||
M.IsolateRepository isolates,
|
||||
M.EventRepository events,
|
||||
M.ScriptRepository scripts,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(isolates != null);
|
||||
assert(events != null);
|
||||
|
@ -98,10 +98,9 @@ class IsolateSummaryElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['flex-row', 'isolate-state-container']
|
||||
..children = <Element>[
|
||||
new IsolateRunStateElement(_isolate as M.Isolate, _events,
|
||||
queue: _r.queue)
|
||||
new IsolateRunStateElement(_isolate, _events, queue: _r.queue)
|
||||
.element,
|
||||
new IsolateLocationElement(_isolate as M.Isolate, _events, _scripts,
|
||||
new IsolateLocationElement(_isolate, _events, _scripts,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new SpanElement()..text = ' [',
|
||||
|
@ -113,14 +112,14 @@ class IsolateSummaryElement extends CustomElement implements Renderable {
|
|||
|
||||
Element memoryRow() {
|
||||
final isolate = _isolate as M.Isolate;
|
||||
final newHeapUsed = Utils.formatSize(isolate.newSpace!.used);
|
||||
final newHeapCapacity = Utils.formatSize(isolate.newSpace!.capacity);
|
||||
final oldHeapUsed = Utils.formatSize(isolate.oldSpace!.used);
|
||||
final oldHeapCapacity = Utils.formatSize(isolate.oldSpace!.capacity);
|
||||
final newHeapUsed = Utils.formatSize(isolate.newSpace.used);
|
||||
final newHeapCapacity = Utils.formatSize(isolate.newSpace.capacity);
|
||||
final oldHeapUsed = Utils.formatSize(isolate.oldSpace.used);
|
||||
final oldHeapCapacity = Utils.formatSize(isolate.oldSpace.capacity);
|
||||
final heapUsed =
|
||||
Utils.formatSize(isolate.newSpace!.used + isolate.oldSpace!.used);
|
||||
final heapCapacity = Utils.formatSize(
|
||||
isolate.newSpace!.capacity + isolate.oldSpace!.capacity);
|
||||
Utils.formatSize(isolate.newSpace.used + isolate.oldSpace.used);
|
||||
final heapCapacity =
|
||||
Utils.formatSize(isolate.newSpace.capacity + isolate.oldSpace.capacity);
|
||||
return new DivElement()
|
||||
..classes = ['flex-row-wrap-right']
|
||||
..children = <Element>[
|
||||
|
|
|
@ -23,25 +23,25 @@ class IsolateReconnectElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<IsolateReconnectElement> _r;
|
||||
RenderingScheduler<IsolateReconnectElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateReconnectElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late String _missing;
|
||||
late Uri _uri;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _subscription;
|
||||
M.VM _vm;
|
||||
String _missing;
|
||||
Uri _uri;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _subscription;
|
||||
|
||||
M.VM get vm => _vm;
|
||||
String get missing => _missing;
|
||||
Uri get uri => _uri;
|
||||
|
||||
late M.NotificationRepository _notifications;
|
||||
M.NotificationRepository _notifications;
|
||||
factory IsolateReconnectElement(M.VM vm, M.EventRepository events,
|
||||
M.NotificationRepository notifications, String missing, Uri uri,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(events != null);
|
||||
assert(missing != null);
|
||||
|
@ -63,7 +63,7 @@ class IsolateReconnectElement extends CustomElement implements Renderable {
|
|||
void attached() {
|
||||
super.attached();
|
||||
_subscription = _events.onVMUpdate.listen((e) {
|
||||
_vm = e.vm as M.VM;
|
||||
_vm = e.vm;
|
||||
_r.dirty();
|
||||
});
|
||||
_r.enable();
|
||||
|
|
|
@ -14,18 +14,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class IsolateRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<IsolateRefElement>('isolate-ref');
|
||||
|
||||
late RenderingScheduler<IsolateRefElement> _r;
|
||||
RenderingScheduler<IsolateRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _updatesSubscription;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _updatesSubscription;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
||||
factory IsolateRefElement(M.IsolateRef isolate, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
IsolateRefElement e = new IsolateRefElement.created();
|
||||
|
|
|
@ -51,23 +51,23 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<IsolateViewElement> _r;
|
||||
RenderingScheduler<IsolateViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<IsolateViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.Isolate _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.IsolateRepository _isolates;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.FunctionRepository _functions;
|
||||
late M.LibraryRepository _libraries;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.EvalRepository _eval;
|
||||
M.ServiceFunction? _function;
|
||||
M.ScriptRef? _rootScript;
|
||||
late StreamSubscription _subscription;
|
||||
M.VM _vm;
|
||||
M.Isolate _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.IsolateRepository _isolates;
|
||||
M.ScriptRepository _scripts;
|
||||
M.FunctionRepository _functions;
|
||||
M.LibraryRepository _libraries;
|
||||
M.ObjectRepository _objects;
|
||||
M.EvalRepository _eval;
|
||||
M.ServiceFunction _function;
|
||||
M.ScriptRef _rootScript;
|
||||
StreamSubscription _subscription;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.Isolate get isolate => _isolate;
|
||||
|
@ -84,7 +84,7 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
M.LibraryRepository libraries,
|
||||
M.ObjectRepository objects,
|
||||
M.EvalRepository eval,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -134,9 +134,9 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
void render() {
|
||||
final uptime = new DateTime.now().difference(_isolate.startTime!);
|
||||
final libraries = _isolate.libraries!.toList();
|
||||
final List<M.Thread> threads = _isolate.threads!.toList();
|
||||
final uptime = new DateTime.now().difference(_isolate.startTime);
|
||||
final libraries = _isolate.libraries.toList();
|
||||
final List<M.Thread> threads = _isolate.threads;
|
||||
children = <Element>[
|
||||
navBar(<Element>[
|
||||
new NavTopMenuElement(queue: _r.queue).element,
|
||||
|
@ -185,11 +185,11 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
..children = _function != null
|
||||
? [
|
||||
new BRElement(),
|
||||
(new SourceInsetElement(_isolate, _function!.location!,
|
||||
(new SourceInsetElement(_isolate, _function.location,
|
||||
_scripts, _objects, _events,
|
||||
currentPos: M
|
||||
.topFrame(isolate.pauseEvent)!
|
||||
.location!
|
||||
.topFrame(isolate.pauseEvent)
|
||||
.location
|
||||
.tokenPos,
|
||||
queue: _r.queue)
|
||||
..classes = ['header_inset'])
|
||||
|
@ -235,7 +235,7 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
_isolate.rootLibrary == null
|
||||
? (new SpanElement()..text = 'loading...')
|
||||
: new LibraryRefElement(
|
||||
_isolate, _isolate.rootLibrary!,
|
||||
_isolate, _isolate.rootLibrary,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -250,7 +250,7 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[
|
||||
new FunctionRefElement(_isolate, _isolate.entry!,
|
||||
new FunctionRefElement(_isolate, _isolate.entry,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -361,7 +361,7 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
]
|
||||
],
|
||||
new HRElement(),
|
||||
new EvalBoxElement(_isolate, _isolate.rootLibrary!, _objects, _eval,
|
||||
new EvalBoxElement(_isolate, _isolate.rootLibrary, _objects, _eval,
|
||||
queue: _r.queue)
|
||||
.element,
|
||||
new DivElement()
|
||||
|
@ -369,7 +369,7 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
? [
|
||||
new HRElement(),
|
||||
new ScriptInsetElement(
|
||||
_isolate, _rootScript!, _scripts, _objects, _events,
|
||||
_isolate, _rootScript, _scripts, _objects, _events,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -410,11 +410,11 @@ class IsolateViewElement extends CustomElement implements Renderable {
|
|||
_rootScript = null;
|
||||
final frame = M.topFrame(_isolate.pauseEvent);
|
||||
if (frame != null) {
|
||||
_function = await _functions.get(_isolate, frame.function!.id!);
|
||||
_function = await _functions.get(_isolate, frame.function.id);
|
||||
}
|
||||
if (_isolate.rootLibrary != null) {
|
||||
final rootLibrary =
|
||||
await _libraries.get(_isolate, _isolate.rootLibrary!.id!);
|
||||
await _libraries.get(_isolate, _isolate.rootLibrary.id);
|
||||
_rootScript = rootLibrary.rootScript;
|
||||
}
|
||||
_r.dirty();
|
||||
|
|
|
@ -22,18 +22,18 @@ class JSONViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<JSONViewElement> _r;
|
||||
RenderingScheduler<JSONViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<JSONViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.NotificationRepository _notifications;
|
||||
late Map _map;
|
||||
M.NotificationRepository _notifications;
|
||||
Map _map;
|
||||
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
Map get map => _map;
|
||||
|
||||
factory JSONViewElement(Map map, M.NotificationRepository notifications,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(notifications != null);
|
||||
assert(map != null);
|
||||
JSONViewElement e = new JSONViewElement.created();
|
||||
|
|
|
@ -14,18 +14,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class LibraryRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<LibraryRefElement>('library-ref');
|
||||
|
||||
late RenderingScheduler<LibraryRefElement> _r;
|
||||
RenderingScheduler<LibraryRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<LibraryRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.LibraryRef _library;
|
||||
M.IsolateRef _isolate;
|
||||
M.LibraryRef _library;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.LibraryRef get library => _library;
|
||||
|
||||
factory LibraryRefElement(M.IsolateRef isolate, M.LibraryRef library,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(library != null);
|
||||
LibraryRefElement e = new LibraryRefElement.created();
|
||||
|
|
|
@ -49,25 +49,25 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<LibraryViewElement> _r;
|
||||
RenderingScheduler<LibraryViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<LibraryViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Library _library;
|
||||
late M.LibraryRepository _libraries;
|
||||
late M.FieldRepository _fields;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ScriptRepository _scripts;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.EvalRepository _eval;
|
||||
Iterable<M.Field>? _variables;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Library _library;
|
||||
M.LibraryRepository _libraries;
|
||||
M.FieldRepository _fields;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ScriptRepository _scripts;
|
||||
M.ObjectRepository _objects;
|
||||
M.EvalRepository _eval;
|
||||
Iterable<M.Field> _variables;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -89,7 +89,7 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
M.ScriptRepository scripts,
|
||||
M.ObjectRepository objects,
|
||||
M.EvalRepository eval,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -217,19 +217,19 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Future _refresh() async {
|
||||
_library = await _libraries.get(_isolate, _library.id!);
|
||||
_library = await _libraries.get(_isolate, _library.id);
|
||||
_variables = null;
|
||||
_r.dirty();
|
||||
_variables = await Future.wait(
|
||||
_library.variables!.map((field) => _fields.get(_isolate, field.id!)));
|
||||
_library.variables.map((field) => _fields.get(_isolate, field.id)));
|
||||
_r.dirty();
|
||||
}
|
||||
|
||||
Element _createDependencies() {
|
||||
if (_library.dependencies!.isEmpty) {
|
||||
if (_library.dependencies.isEmpty) {
|
||||
return new SpanElement();
|
||||
}
|
||||
final dependencies = _library.dependencies!.toList();
|
||||
final dependencies = _library.dependencies.toList();
|
||||
return new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'dependencies (${dependencies.length}) ',
|
||||
|
@ -252,10 +252,10 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Element _createScripts() {
|
||||
if (_library.scripts!.isEmpty) {
|
||||
if (_library.scripts.isEmpty) {
|
||||
return new SpanElement();
|
||||
}
|
||||
final scripts = _library.scripts!.toList();
|
||||
final scripts = _library.scripts.toList();
|
||||
return new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'scripts (${scripts.length}) ',
|
||||
|
@ -272,10 +272,10 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Element _createClasses() {
|
||||
if (_library.classes!.isEmpty) {
|
||||
if (_library.classes.isEmpty) {
|
||||
return new SpanElement();
|
||||
}
|
||||
final classes = _library.classes!.toList();
|
||||
final classes = _library.classes.toList();
|
||||
return new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'classes (${classes.length}) ',
|
||||
|
@ -292,10 +292,10 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Element _createVariables() {
|
||||
if (_library.variables!.isEmpty) {
|
||||
if (_library.variables.isEmpty) {
|
||||
return new SpanElement();
|
||||
}
|
||||
final variables = _library.variables!.toList();
|
||||
final variables = _library.variables.toList();
|
||||
return new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'variables (${variables.length}) ',
|
||||
|
@ -305,7 +305,7 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
? (new SpanElement()..text = 'loading...')
|
||||
: (new DivElement()
|
||||
..classes = ['indent', 'memberList']
|
||||
..children = _variables!
|
||||
..children = _variables
|
||||
.map<Element>((f) => new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -331,10 +331,10 @@ class LibraryViewElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
Element _createFunctions() {
|
||||
if (_library.functions!.isEmpty) {
|
||||
if (_library.functions.isEmpty) {
|
||||
return new SpanElement();
|
||||
}
|
||||
final functions = _library.functions!.toList();
|
||||
final functions = _library.functions.toList();
|
||||
return new DivElement()
|
||||
..children = <Element>[
|
||||
new SpanElement()..text = 'functions (${functions.length}) ',
|
||||
|
|
|
@ -14,20 +14,20 @@ class LocalVarDescriptorsRefElement extends CustomElement
|
|||
implements Renderable {
|
||||
static const tag = const Tag<LocalVarDescriptorsRefElement>('var-ref');
|
||||
|
||||
late RenderingScheduler<LocalVarDescriptorsRefElement> _r;
|
||||
RenderingScheduler<LocalVarDescriptorsRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<LocalVarDescriptorsRefElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.LocalVarDescriptorsRef _localVar;
|
||||
M.IsolateRef _isolate;
|
||||
M.LocalVarDescriptorsRef _localVar;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.LocalVarDescriptorsRef get localVar => _localVar;
|
||||
|
||||
factory LocalVarDescriptorsRefElement(
|
||||
M.IsolateRef isolate, M.LocalVarDescriptorsRef localVar,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(localVar != null);
|
||||
LocalVarDescriptorsRefElement e =
|
||||
|
|
|
@ -34,15 +34,15 @@ class LoggingPageElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<LoggingPageElement> _r;
|
||||
RenderingScheduler<LoggingPageElement> _r;
|
||||
|
||||
Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late Level _level = Level.ALL;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
Level _level = Level.ALL;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -50,7 +50,7 @@ class LoggingPageElement extends CustomElement implements Renderable {
|
|||
|
||||
factory LoggingPageElement(M.VM vm, M.IsolateRef isolate,
|
||||
M.EventRepository events, M.NotificationRepository notifications,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -79,11 +79,11 @@ class LoggingPageElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
LoggingListElement? _logs;
|
||||
LoggingListElement _logs;
|
||||
|
||||
void render() {
|
||||
_logs = _logs ?? new LoggingListElement(_isolate, _events);
|
||||
_logs!.level = _level;
|
||||
_logs.level = _level;
|
||||
children = <Element>[
|
||||
navBar(<Element>[
|
||||
new NavTopMenuElement(queue: _r.queue).element,
|
||||
|
@ -106,7 +106,7 @@ class LoggingPageElement extends CustomElement implements Renderable {
|
|||
new SpanElement()..text = 'Show messages with severity ',
|
||||
_createLevelSelector(),
|
||||
new HRElement(),
|
||||
_logs!.element
|
||||
_logs.element
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ import 'package:observatory/utils.dart';
|
|||
class LoggingListElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<LoggingListElement>('logging-list');
|
||||
|
||||
late RenderingScheduler<LoggingListElement> _r;
|
||||
RenderingScheduler<LoggingListElement> _r;
|
||||
|
||||
Stream<RenderedEvent<LoggingListElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _subscription;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _subscription;
|
||||
Level _level = Level.ALL;
|
||||
final _logs = <Map>[];
|
||||
|
||||
|
@ -29,7 +29,7 @@ class LoggingListElement extends CustomElement implements Renderable {
|
|||
set level(Level value) => _level = _r.checkAndReact(_level, value);
|
||||
|
||||
factory LoggingListElement(M.IsolateRef isolate, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
LoggingListElement e = new LoggingListElement.created();
|
||||
|
|
|
@ -14,20 +14,20 @@ class MegamorphicCacheRefElement extends CustomElement implements Renderable {
|
|||
static const tag =
|
||||
const Tag<MegamorphicCacheRefElement>('megamorphic-cache-ref');
|
||||
|
||||
late RenderingScheduler<MegamorphicCacheRefElement> _r;
|
||||
RenderingScheduler<MegamorphicCacheRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<MegamorphicCacheRefElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.MegamorphicCacheRef _cache;
|
||||
M.IsolateRef _isolate;
|
||||
M.MegamorphicCacheRef _cache;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.MegamorphicCacheRef get cache => _cache;
|
||||
|
||||
factory MegamorphicCacheRefElement(
|
||||
M.IsolateRef isolate, M.MegamorphicCacheRef cache,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(cache != null);
|
||||
MegamorphicCacheRefElement e = new MegamorphicCacheRefElement.created();
|
||||
|
|
|
@ -37,22 +37,22 @@ class MegamorphicCacheViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<MegamorphicCacheViewElement> _r;
|
||||
RenderingScheduler<MegamorphicCacheViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<MegamorphicCacheViewElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.MegamorphicCache _cache;
|
||||
late M.MegamorphicCacheRepository _caches;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.MegamorphicCache _cache;
|
||||
M.MegamorphicCacheRepository _caches;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -71,7 +71,7 @@ class MegamorphicCacheViewElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -124,7 +124,7 @@ class MegamorphicCacheViewElement extends CustomElement implements Renderable {
|
|||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
_cache = await _caches.get(_isolate, _cache.id!);
|
||||
_cache = await _caches.get(_isolate, _cache.id);
|
||||
_r.dirty();
|
||||
}))
|
||||
.element,
|
||||
|
|
|
@ -11,20 +11,20 @@ import 'package:observatory/src/elements/helpers/tag.dart';
|
|||
class MetricDetailsElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<MetricDetailsElement>('metric-details');
|
||||
|
||||
late RenderingScheduler<MetricDetailsElement> _r;
|
||||
RenderingScheduler<MetricDetailsElement> _r;
|
||||
|
||||
Stream<RenderedEvent<MetricDetailsElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.Metric _metric;
|
||||
late M.MetricRepository _metrics;
|
||||
M.IsolateRef _isolate;
|
||||
M.Metric _metric;
|
||||
M.MetricRepository _metrics;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.Metric get metric => _metric;
|
||||
|
||||
factory MetricDetailsElement(
|
||||
M.IsolateRef isolate, M.Metric metric, M.MetricRepository metrics,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(metric != null);
|
||||
assert(metrics != null);
|
||||
|
|
|
@ -11,21 +11,21 @@ import 'package:observatory/src/elements/helpers/tag.dart';
|
|||
class MetricGraphElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<MetricGraphElement>('metric-graph');
|
||||
|
||||
late RenderingScheduler<MetricGraphElement> _r;
|
||||
RenderingScheduler<MetricGraphElement> _r;
|
||||
|
||||
Stream<RenderedEvent<MetricGraphElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.Metric _metric;
|
||||
late M.MetricRepository _metrics;
|
||||
late Timer _timer;
|
||||
M.IsolateRef _isolate;
|
||||
M.Metric _metric;
|
||||
M.MetricRepository _metrics;
|
||||
Timer _timer;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.Metric get metric => _metric;
|
||||
|
||||
factory MetricGraphElement(
|
||||
M.IsolateRef isolate, M.Metric metric, M.MetricRepository metrics,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(metric != null);
|
||||
assert(metrics != null);
|
||||
|
@ -58,8 +58,8 @@ class MetricGraphElement extends CustomElement implements Renderable {
|
|||
final min = _metrics.getMinValue(_isolate, _metric);
|
||||
final max = _metrics.getMaxValue(_isolate, _metric);
|
||||
final rows = _metrics
|
||||
.getSamples(_isolate, _metric)!
|
||||
.map((s) => [s.time!.millisecondsSinceEpoch, s.value])
|
||||
.getSamples(_isolate, _metric)
|
||||
.map((s) => [s.time.millisecondsSinceEpoch, s.value])
|
||||
.toList();
|
||||
final current = rows.last.last;
|
||||
|
||||
|
|
|
@ -31,17 +31,17 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
NavNotifyElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<MetricsPageElement> _r;
|
||||
RenderingScheduler<MetricsPageElement> _r;
|
||||
|
||||
Stream<RenderedEvent<MetricsPageElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.MetricRepository _metrics;
|
||||
List<M.Metric>? _available;
|
||||
M.Metric? _selected;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.MetricRepository _metrics;
|
||||
List<M.Metric> _available;
|
||||
M.Metric _selected;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -53,7 +53,7 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.MetricRepository metrics,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -125,7 +125,7 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
..children = _selected == null
|
||||
? const []
|
||||
: [
|
||||
new MetricDetailsElement(_isolate, _selected!, _metrics,
|
||||
new MetricDetailsElement(_isolate, _selected, _metrics,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
],
|
||||
|
@ -135,7 +135,7 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
..children = _selected == null
|
||||
? const []
|
||||
: [
|
||||
new MetricGraphElement(_isolate, _selected!, _metrics,
|
||||
new MetricGraphElement(_isolate, _selected, _metrics,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -145,8 +145,8 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
|
||||
Future _refresh() async {
|
||||
_available = (await _metrics.list(_isolate)).toList();
|
||||
if (!_available!.contains(_selected)) {
|
||||
_selected = _available!.first;
|
||||
if (!_available.contains(_selected)) {
|
||||
_selected = _available.first;
|
||||
}
|
||||
_r.dirty();
|
||||
}
|
||||
|
@ -155,14 +155,14 @@ class MetricsPageElement extends CustomElement implements Renderable {
|
|||
var s;
|
||||
return [
|
||||
s = new SelectElement()
|
||||
..value = _selected!.name!
|
||||
..children = _available!.map((metric) {
|
||||
..value = _selected.name
|
||||
..children = _available.map((metric) {
|
||||
return new OptionElement(
|
||||
value: metric.name!, selected: _selected == metric)
|
||||
..text = metric.name!;
|
||||
value: metric.name, selected: _selected == metric)
|
||||
..text = metric.name;
|
||||
}).toList(growable: false)
|
||||
..onChange.listen((_) {
|
||||
_selected = _available![s.selectedIndex];
|
||||
_selected = _available[s.selectedIndex];
|
||||
_r.dirty();
|
||||
})
|
||||
];
|
||||
|
|
|
@ -33,21 +33,21 @@ class NativeMemoryProfileElement extends CustomElement implements Renderable {
|
|||
CpuProfileVirtualTreeElement.tag,
|
||||
]);
|
||||
|
||||
late RenderingScheduler<NativeMemoryProfileElement> _r;
|
||||
RenderingScheduler<NativeMemoryProfileElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NativeMemoryProfileElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.NativeMemorySampleProfileRepository _profiles;
|
||||
Stream<M.SampleProfileLoadingProgressEvent>? _progressStream;
|
||||
M.SampleProfileLoadingProgress? _progress;
|
||||
late M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
late ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
late String _filter = '';
|
||||
M.VM _vm;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.NativeMemorySampleProfileRepository _profiles;
|
||||
Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
|
||||
M.SampleProfileLoadingProgress _progress;
|
||||
M.SampleProfileTag _tag = M.SampleProfileTag.none;
|
||||
ProfileTreeMode _mode = ProfileTreeMode.function;
|
||||
M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
|
||||
String _filter = '';
|
||||
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
M.NativeMemorySampleProfileRepository get profiles => _profiles;
|
||||
|
@ -57,7 +57,7 @@ class NativeMemoryProfileElement extends CustomElement implements Renderable {
|
|||
M.EventRepository events,
|
||||
M.NotificationRepository notifications,
|
||||
M.NativeMemorySampleProfileRepository profiles,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(events != null);
|
||||
assert(notifications != null);
|
||||
|
@ -102,16 +102,15 @@ class NativeMemoryProfileElement extends CustomElement implements Renderable {
|
|||
children = content;
|
||||
return;
|
||||
}
|
||||
content.add((new SampleBufferControlElement(
|
||||
_vm, _progress!, _progressStream!,
|
||||
content.add((new SampleBufferControlElement(_vm, _progress, _progressStream,
|
||||
selectedTag: _tag, queue: _r.queue)
|
||||
..onTagChange.listen((e) {
|
||||
_tag = e.element.selectedTag;
|
||||
_request();
|
||||
}))
|
||||
.element);
|
||||
if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
late CpuProfileVirtualTreeElement tree;
|
||||
if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
|
||||
CpuProfileVirtualTreeElement tree;
|
||||
content.addAll([
|
||||
new BRElement(),
|
||||
(new StackTraceTreeConfigElement(
|
||||
|
@ -137,7 +136,7 @@ class NativeMemoryProfileElement extends CustomElement implements Renderable {
|
|||
}))
|
||||
.element,
|
||||
new BRElement(),
|
||||
(tree = new CpuProfileVirtualTreeElement(null, _progress!.profile,
|
||||
(tree = new CpuProfileVirtualTreeElement(null, _progress.profile,
|
||||
queue: _r.queue, type: M.SampleProfileType.memory))
|
||||
.element,
|
||||
]);
|
||||
|
@ -147,17 +146,17 @@ class NativeMemoryProfileElement extends CustomElement implements Renderable {
|
|||
|
||||
Future _request({bool forceFetch: false}) async {
|
||||
if (forceFetch) {
|
||||
for (M.IsolateRef isolate in _vm.isolates) {
|
||||
for (M.Isolate isolate in _vm.isolates) {
|
||||
await isolate.collectAllGarbage();
|
||||
}
|
||||
}
|
||||
_progress = null;
|
||||
_progressStream = _profiles.get(_vm, _tag, forceFetch: forceFetch);
|
||||
_r.dirty();
|
||||
_progress = (await _progressStream!.first).progress;
|
||||
_progress = (await _progressStream.first).progress;
|
||||
_r.dirty();
|
||||
if (M.isSampleProcessRunning(_progress!.status)) {
|
||||
_progress = (await _progressStream!.last).progress;
|
||||
if (M.isSampleProcessRunning(_progress.status)) {
|
||||
_progress = (await _progressStream.last).progress;
|
||||
_r.dirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class NavClassMenuElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavClassMenuElement>('nav-class-menu');
|
||||
|
||||
late RenderingScheduler<NavClassMenuElement> _r;
|
||||
RenderingScheduler<NavClassMenuElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavClassMenuElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ClassRef _cls;
|
||||
List<Element> _content = const [];
|
||||
M.IsolateRef _isolate;
|
||||
M.ClassRef _cls;
|
||||
Iterable<Element> _content = const [];
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.ClassRef get cls => _cls;
|
||||
List<Element> get content => _content;
|
||||
Iterable<Element> get content => _content;
|
||||
|
||||
set content(Iterable<Element> value) {
|
||||
_content = value.toList();
|
||||
|
@ -31,7 +31,7 @@ class NavClassMenuElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory NavClassMenuElement(M.IsolateRef isolate, M.ClassRef cls,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(cls != null);
|
||||
NavClassMenuElement e = new NavClassMenuElement.created();
|
||||
|
@ -58,7 +58,7 @@ class NavClassMenuElement extends CustomElement implements Renderable {
|
|||
|
||||
void render() {
|
||||
children = <Element>[
|
||||
navMenu(cls.name!,
|
||||
navMenu(cls.name,
|
||||
content: _content, link: Uris.inspect(isolate, object: cls))
|
||||
];
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ class NavIsolateMenuElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<NavIsolateMenuElement>('nav-isolate-menu',
|
||||
dependencies: const [NavMenuItemElement.tag]);
|
||||
|
||||
late RenderingScheduler<NavIsolateMenuElement> _r;
|
||||
RenderingScheduler<NavIsolateMenuElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavIsolateMenuElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
StreamSubscription? _updatesSubscription;
|
||||
late Iterable<Element> _content = const [];
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _updatesSubscription;
|
||||
Iterable<Element> _content = const [];
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
Iterable<Element> get content => _content;
|
||||
|
@ -33,7 +33,7 @@ class NavIsolateMenuElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory NavIsolateMenuElement(M.IsolateRef isolate, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
NavIsolateMenuElement e = new NavIsolateMenuElement.created();
|
||||
|
@ -63,7 +63,7 @@ class NavIsolateMenuElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
_r.disable(notify: true);
|
||||
assert(_updatesSubscription != null);
|
||||
_updatesSubscription!.cancel();
|
||||
_updatesSubscription.cancel();
|
||||
_updatesSubscription = null;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class NavIsolateMenuElement extends CustomElement implements Renderable {
|
|||
.element,
|
||||
]..addAll(_content);
|
||||
children = <Element>[
|
||||
navMenu(isolate.name!, content: content, link: Uris.inspect(isolate))
|
||||
navMenu(isolate.name, content: content, link: Uris.inspect(isolate))
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class NavLibraryMenuElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavLibraryMenuElement>('nav-library-menu');
|
||||
|
||||
late RenderingScheduler<NavLibraryMenuElement> _r;
|
||||
RenderingScheduler<NavLibraryMenuElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavLibraryMenuElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.LibraryRef _library;
|
||||
List<Element> _content = const [];
|
||||
M.IsolateRef _isolate;
|
||||
M.LibraryRef _library;
|
||||
Iterable<Element> _content = const [];
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.LibraryRef get library => _library;
|
||||
List<Element> get content => _content;
|
||||
Iterable<Element> get content => _content;
|
||||
|
||||
set content(Iterable<Element> value) {
|
||||
_content = value.toList();
|
||||
|
@ -31,7 +31,7 @@ class NavLibraryMenuElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory NavLibraryMenuElement(M.IsolateRef isolate, M.LibraryRef library,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(library != null);
|
||||
NavLibraryMenuElement e = new NavLibraryMenuElement.created();
|
||||
|
@ -58,7 +58,7 @@ class NavLibraryMenuElement extends CustomElement implements Renderable {
|
|||
|
||||
void render() {
|
||||
children = <Element>[
|
||||
navMenu(library.name!,
|
||||
navMenu(library.name,
|
||||
content: _content,
|
||||
link: Uris.inspect(isolate, object: library).toString())
|
||||
];
|
||||
|
|
|
@ -10,17 +10,17 @@ import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
|
|||
class NavMenuItemElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavMenuItemElement>('nav-menu-item');
|
||||
|
||||
late RenderingScheduler<NavMenuItemElement> _r;
|
||||
RenderingScheduler<NavMenuItemElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavMenuItemElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late String _label;
|
||||
late String _link;
|
||||
List<Element> _content = const <Element>[];
|
||||
String _label;
|
||||
String _link;
|
||||
Iterable<Element> _content = const <Element>[];
|
||||
|
||||
String get label => _label;
|
||||
String get link => _link;
|
||||
List<Element> get content => _content;
|
||||
Iterable<Element> get content => _content;
|
||||
|
||||
set label(String value) => _label = _r.checkAndReact(_label, value);
|
||||
set link(String value) => _link = _r.checkAndReact(_link, value);
|
||||
|
@ -30,7 +30,7 @@ class NavMenuItemElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory NavMenuItemElement(String label,
|
||||
{String link = '', RenderingQueue? queue}) {
|
||||
{String link, RenderingQueue queue}) {
|
||||
assert(label != null);
|
||||
NavMenuItemElement e = new NavMenuItemElement.created();
|
||||
e._r = new RenderingScheduler<NavMenuItemElement>(e, queue: queue);
|
||||
|
|
|
@ -17,14 +17,14 @@ class NavNotifyElement extends CustomElement implements Renderable {
|
|||
NavNotifyExceptionElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<NavNotifyElement> _r;
|
||||
RenderingScheduler<NavNotifyElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavNotifyElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.NotificationRepository _repository;
|
||||
StreamSubscription? _subscription;
|
||||
M.NotificationRepository _repository;
|
||||
StreamSubscription _subscription;
|
||||
|
||||
late bool _notifyOnPause;
|
||||
bool _notifyOnPause;
|
||||
|
||||
bool get notifyOnPause => _notifyOnPause;
|
||||
|
||||
|
@ -32,7 +32,7 @@ class NavNotifyElement extends CustomElement implements Renderable {
|
|||
_notifyOnPause = _r.checkAndReact(_notifyOnPause, value);
|
||||
|
||||
factory NavNotifyElement(M.NotificationRepository repository,
|
||||
{bool notifyOnPause: true, RenderingQueue? queue}) {
|
||||
{bool notifyOnPause: true, RenderingQueue queue}) {
|
||||
assert(repository != null);
|
||||
assert(notifyOnPause != null);
|
||||
NavNotifyElement e = new NavNotifyElement.created();
|
||||
|
@ -56,7 +56,7 @@ class NavNotifyElement extends CustomElement implements Renderable {
|
|||
super.detached();
|
||||
children = <Element>[];
|
||||
_r.disable(notify: true);
|
||||
_subscription!.cancel();
|
||||
_subscription.cancel();
|
||||
}
|
||||
|
||||
void render() {
|
||||
|
|
|
@ -17,7 +17,7 @@ class EventDeleteEvent {
|
|||
class NavNotifyEventElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavNotifyEventElement>('nav-event');
|
||||
|
||||
late RenderingScheduler<NavNotifyEventElement> _r;
|
||||
RenderingScheduler<NavNotifyEventElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered;
|
||||
|
||||
|
@ -25,11 +25,11 @@ class NavNotifyEventElement extends CustomElement implements Renderable {
|
|||
new StreamController<EventDeleteEvent>.broadcast();
|
||||
Stream<EventDeleteEvent> get onDelete => _onDelete.stream;
|
||||
|
||||
late M.Event _event;
|
||||
M.Event _event;
|
||||
|
||||
M.Event get event => _event;
|
||||
|
||||
factory NavNotifyEventElement(M.Event event, {RenderingQueue? queue}) {
|
||||
factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) {
|
||||
assert(event != null);
|
||||
NavNotifyEventElement e = new NavNotifyEventElement.created();
|
||||
e._r = new RenderingScheduler<NavNotifyEventElement>(e, queue: queue);
|
||||
|
@ -118,7 +118,7 @@ class NavNotifyEventElement extends CustomElement implements Renderable {
|
|||
M.PauseBreakpointEvent event) {
|
||||
String message = ' is paused';
|
||||
if (event.breakpoint != null) {
|
||||
message += ' at breakpoint ${event.breakpoint!.number}';
|
||||
message += ' at breakpoint ${event.breakpoint.number}';
|
||||
}
|
||||
return [
|
||||
new SpanElement()..text = 'Isolate ',
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'package:observatory/models.dart' show ConnectionException;
|
|||
|
||||
class ExceptionDeleteEvent {
|
||||
final dynamic exception;
|
||||
final StackTrace? stacktrace;
|
||||
final StackTrace stacktrace;
|
||||
|
||||
ExceptionDeleteEvent(this.exception, {this.stacktrace});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class ExceptionDeleteEvent {
|
|||
class NavNotifyExceptionElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavNotifyExceptionElement>('nav-exception');
|
||||
|
||||
late RenderingScheduler<NavNotifyExceptionElement> _r;
|
||||
RenderingScheduler<NavNotifyExceptionElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavNotifyExceptionElement>> get onRendered =>
|
||||
_r.onRendered;
|
||||
|
@ -28,14 +28,14 @@ class NavNotifyExceptionElement extends CustomElement implements Renderable {
|
|||
new StreamController<ExceptionDeleteEvent>.broadcast();
|
||||
Stream<ExceptionDeleteEvent> get onDelete => _onDelete.stream;
|
||||
|
||||
late dynamic _exception;
|
||||
StackTrace? _stacktrace;
|
||||
dynamic _exception;
|
||||
StackTrace _stacktrace;
|
||||
|
||||
dynamic get exception => _exception;
|
||||
StackTrace? get stacktrace => _stacktrace;
|
||||
StackTrace get stacktrace => _stacktrace;
|
||||
|
||||
factory NavNotifyExceptionElement(dynamic exception,
|
||||
{StackTrace? stacktrace: null, RenderingQueue? queue}) {
|
||||
{StackTrace stacktrace: null, RenderingQueue queue}) {
|
||||
assert(exception != null);
|
||||
NavNotifyExceptionElement e = new NavNotifyExceptionElement.created();
|
||||
e._r = new RenderingScheduler<NavNotifyExceptionElement>(e, queue: queue);
|
||||
|
|
|
@ -15,7 +15,7 @@ class RefreshEvent {
|
|||
class NavRefreshElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavRefreshElement>('nav-refresh');
|
||||
|
||||
late RenderingScheduler<NavRefreshElement> _r;
|
||||
RenderingScheduler<NavRefreshElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered;
|
||||
|
||||
|
@ -23,8 +23,8 @@ class NavRefreshElement extends CustomElement implements Renderable {
|
|||
new StreamController<RefreshEvent>.broadcast();
|
||||
Stream<RefreshEvent> get onRefresh => _onRefresh.stream;
|
||||
|
||||
late bool _disabled;
|
||||
late String _label;
|
||||
bool _disabled;
|
||||
String _label;
|
||||
|
||||
bool get disabled => _disabled;
|
||||
String get label => _label;
|
||||
|
@ -33,7 +33,7 @@ class NavRefreshElement extends CustomElement implements Renderable {
|
|||
set label(String value) => _label = _r.checkAndReact(_label, value);
|
||||
|
||||
factory NavRefreshElement(
|
||||
{String label: 'Refresh', bool disabled: false, RenderingQueue? queue}) {
|
||||
{String label: 'Refresh', bool disabled: false, RenderingQueue queue}) {
|
||||
assert(label != null);
|
||||
assert(disabled != null);
|
||||
NavRefreshElement e = new NavRefreshElement.created();
|
||||
|
|
|
@ -18,7 +18,7 @@ class ReloadEvent {
|
|||
class NavReloadElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<NavReloadElement>('nav-reload');
|
||||
|
||||
late RenderingScheduler<NavReloadElement> _r;
|
||||
RenderingScheduler<NavReloadElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavReloadElement>> get onRendered => _r.onRendered;
|
||||
|
||||
|
@ -26,15 +26,15 @@ class NavReloadElement extends CustomElement implements Renderable {
|
|||
new StreamController<ReloadEvent>.broadcast();
|
||||
Stream<ReloadEvent> get onReload => _onReload.stream;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.IsolateRepository _isolates;
|
||||
late M.EventRepository _events;
|
||||
StreamSubscription? _sub;
|
||||
M.IsolateRef _isolate;
|
||||
M.IsolateRepository _isolates;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _sub;
|
||||
bool _disabled = false;
|
||||
|
||||
factory NavReloadElement(M.IsolateRef isolate, M.IsolateRepository isolates,
|
||||
M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(isolates != null);
|
||||
assert(events != null);
|
||||
|
@ -59,7 +59,7 @@ class NavReloadElement extends CustomElement implements Renderable {
|
|||
void detached() {
|
||||
super.detached();
|
||||
children = <Element>[];
|
||||
_sub!.cancel();
|
||||
_sub.cancel();
|
||||
_sub = null;
|
||||
_r.disable(notify: true);
|
||||
}
|
||||
|
@ -84,15 +84,13 @@ class NavReloadElement extends CustomElement implements Renderable {
|
|||
.listen((_) => _reload(_isolates.reloadSourcesServices.single))
|
||||
]);
|
||||
} else {
|
||||
final content = _isolates.reloadSourcesServices
|
||||
.map((s) => new LIElement()
|
||||
..children = <Element>[
|
||||
new ButtonElement()
|
||||
..text = s.alias
|
||||
..disabled = _disabled
|
||||
..onClick.listen((_) => _reload(s))
|
||||
])
|
||||
.toList();
|
||||
final content = _isolates.reloadSourcesServices.map((s) => new LIElement()
|
||||
..children = <Element>[
|
||||
new ButtonElement()
|
||||
..text = s.alias
|
||||
..disabled = _disabled
|
||||
..onClick.listen((_) => _reload(s))
|
||||
]);
|
||||
children.add(navMenu('Reload Source', content: content));
|
||||
}
|
||||
this.children = children;
|
||||
|
|
|
@ -14,7 +14,7 @@ class NavTopMenuElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<NavTopMenuElement>('nav-top-menu',
|
||||
dependencies: const [NavMenuItemElement.tag]);
|
||||
|
||||
late RenderingScheduler<NavTopMenuElement> _r;
|
||||
RenderingScheduler<NavTopMenuElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class NavTopMenuElement extends CustomElement implements Renderable {
|
|||
_r.dirty();
|
||||
}
|
||||
|
||||
factory NavTopMenuElement({RenderingQueue? queue}) {
|
||||
factory NavTopMenuElement({RenderingQueue queue}) {
|
||||
NavTopMenuElement e = new NavTopMenuElement.created();
|
||||
e._r = new RenderingScheduler<NavTopMenuElement>(e, queue: queue);
|
||||
return e;
|
||||
|
|
|
@ -15,13 +15,13 @@ class NavVMMenuElement extends CustomElement implements Renderable {
|
|||
static const tag = const Tag<NavVMMenuElement>('nav-vm-menu',
|
||||
dependencies: const [NavMenuItemElement.tag]);
|
||||
|
||||
late RenderingScheduler<NavVMMenuElement> _r;
|
||||
RenderingScheduler<NavVMMenuElement> _r;
|
||||
|
||||
Stream<RenderedEvent<NavVMMenuElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.EventRepository _events;
|
||||
late StreamSubscription _updatesSubscription;
|
||||
M.VM _vm;
|
||||
M.EventRepository _events;
|
||||
StreamSubscription _updatesSubscription;
|
||||
Iterable<Element> _content = const [];
|
||||
|
||||
M.VM get vm => _vm;
|
||||
|
@ -33,7 +33,7 @@ class NavVMMenuElement extends CustomElement implements Renderable {
|
|||
}
|
||||
|
||||
factory NavVMMenuElement(M.VM vm, M.EventRepository events,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(events != null);
|
||||
NavVMMenuElement e = new NavVMMenuElement.created();
|
||||
|
@ -49,7 +49,7 @@ class NavVMMenuElement extends CustomElement implements Renderable {
|
|||
void attached() {
|
||||
super.attached();
|
||||
_updatesSubscription = _events.onVMUpdate.listen((e) {
|
||||
_vm = e.vm as M.VM;
|
||||
_vm = e.vm;
|
||||
_r.dirty();
|
||||
});
|
||||
_r.enable();
|
||||
|
@ -65,13 +65,13 @@ class NavVMMenuElement extends CustomElement implements Renderable {
|
|||
|
||||
void render() {
|
||||
final content = (_vm.isolates.map<Element>((isolate) {
|
||||
return new NavMenuItemElement(isolate.name!,
|
||||
return new NavMenuItemElement(isolate.name,
|
||||
queue: _r.queue, link: Uris.inspect(isolate))
|
||||
.element;
|
||||
}).toList()
|
||||
..addAll(_content));
|
||||
children = <Element>[
|
||||
navMenu(vm.displayName!, link: Uris.vm(), content: content)
|
||||
navMenu(vm.displayName, link: Uris.vm(), content: content)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,20 +22,20 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
SentinelValueElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ObjectCommonElement> _r;
|
||||
RenderingScheduler<ObjectCommonElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ObjectCommonElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.Object _object;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
M.Guarded<M.Instance>? _retainedSize = null;
|
||||
M.IsolateRef _isolate;
|
||||
M.Object _object;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
M.Guarded<M.Instance> _retainedSize = null;
|
||||
bool _loadingRetainedBytes = false;
|
||||
M.Guarded<M.Instance>? _reachableSize = null;
|
||||
M.Guarded<M.Instance> _reachableSize = null;
|
||||
bool _loadingReachableBytes = false;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -49,7 +49,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(object != null);
|
||||
assert(retainedSizes != null);
|
||||
|
@ -84,8 +84,8 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
children = <Element>[];
|
||||
}
|
||||
|
||||
RetainingPathElement? _path;
|
||||
InboundReferencesElement? _inbounds;
|
||||
RetainingPathElement _path;
|
||||
InboundReferencesElement _inbounds;
|
||||
|
||||
void render() {
|
||||
_path = _path ??
|
||||
|
@ -109,7 +109,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
..children = <Element>[
|
||||
_object.clazz == null
|
||||
? (new SpanElement()..text = '...')
|
||||
: new ClassRefElement(_isolate, _object.clazz!,
|
||||
: new ClassRefElement(_isolate, _object.clazz,
|
||||
queue: _r.queue)
|
||||
.element
|
||||
]
|
||||
|
@ -157,7 +157,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
..text = 'Retaining path ',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[_path!.element]
|
||||
..children = <Element>[_path.element]
|
||||
],
|
||||
new DivElement()
|
||||
..classes = ['memberItem']
|
||||
|
@ -168,7 +168,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
..text = 'Inbound references ',
|
||||
new DivElement()
|
||||
..classes = ['memberValue']
|
||||
..children = <Element>[_inbounds!.element]
|
||||
..children = <Element>[_inbounds.element]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -177,14 +177,14 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
List<Element> _createReachableSizeValue() {
|
||||
final content = <Element>[];
|
||||
if (_reachableSize != null) {
|
||||
if (_reachableSize!.isSentinel) {
|
||||
content.add(new SentinelValueElement(_reachableSize!.asSentinel!,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
if (_reachableSize.isSentinel) {
|
||||
content.add(
|
||||
new SentinelValueElement(_reachableSize.asSentinel, queue: _r.queue)
|
||||
.element);
|
||||
} else {
|
||||
content.add(new SpanElement()
|
||||
..text = Utils.formatSize(
|
||||
int.parse(_reachableSize!.asValue!.valueAsString!)));
|
||||
int.parse(_reachableSize.asValue.valueAsString)));
|
||||
}
|
||||
} else {
|
||||
content.add(new SpanElement()..text = '...');
|
||||
|
@ -196,7 +196,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
button.onClick.listen((_) async {
|
||||
button.disabled = true;
|
||||
_loadingReachableBytes = true;
|
||||
_reachableSize = await _reachableSizes.get(_isolate, _object.id!);
|
||||
_reachableSize = await _reachableSizes.get(_isolate, _object.id);
|
||||
_r.dirty();
|
||||
});
|
||||
content.add(button);
|
||||
|
@ -206,14 +206,14 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
List<Element> _createRetainedSizeValue() {
|
||||
final content = <Element>[];
|
||||
if (_retainedSize != null) {
|
||||
if (_retainedSize!.isSentinel) {
|
||||
content.add(new SentinelValueElement(_retainedSize!.asSentinel!,
|
||||
queue: _r.queue)
|
||||
.element);
|
||||
if (_retainedSize.isSentinel) {
|
||||
content.add(
|
||||
new SentinelValueElement(_retainedSize.asSentinel, queue: _r.queue)
|
||||
.element);
|
||||
} else {
|
||||
content.add(new SpanElement()
|
||||
..text = Utils.formatSize(
|
||||
int.parse(_retainedSize!.asValue!.valueAsString!)));
|
||||
..text =
|
||||
Utils.formatSize(int.parse(_retainedSize.asValue.valueAsString)));
|
||||
}
|
||||
} else {
|
||||
content.add(new SpanElement()..text = '...');
|
||||
|
@ -225,7 +225,7 @@ class ObjectCommonElement extends CustomElement implements Renderable {
|
|||
button.onClick.listen((_) async {
|
||||
button.disabled = true;
|
||||
_loadingRetainedBytes = true;
|
||||
_retainedSize = await _retainedSizes.get(_isolate, _object.id!);
|
||||
_retainedSize = await _retainedSizes.get(_isolate, _object.id);
|
||||
_r.dirty();
|
||||
});
|
||||
content.add(button);
|
||||
|
|
|
@ -33,24 +33,25 @@ class ObjectViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ObjectViewElement> _r;
|
||||
RenderingScheduler<ObjectViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ObjectViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.Object _object;
|
||||
late M.ObjectRepository _objects;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.Object _object;
|
||||
M.ObjectRepository _objects;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.NotificationRepository get notifications => _notifications;
|
||||
M.Context get object => _object;
|
||||
|
||||
factory ObjectViewElement(
|
||||
M.VM vm,
|
||||
|
@ -63,7 +64,7 @@ class ObjectViewElement extends CustomElement implements Renderable {
|
|||
M.ReachableSizeRepository reachableSizes,
|
||||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -114,7 +115,7 @@ class ObjectViewElement extends CustomElement implements Renderable {
|
|||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
_object = await _objects.get(_isolate, _object.id!);
|
||||
_object = await _objects.get(_isolate, _object.id);
|
||||
_r.dirty();
|
||||
}))
|
||||
.element,
|
||||
|
|
|
@ -12,18 +12,18 @@ import 'package:observatory/src/elements/helpers/uris.dart';
|
|||
class ObjectPoolRefElement extends CustomElement implements Renderable {
|
||||
static const tag = const Tag<ObjectPoolRefElement>('object-pool-ref');
|
||||
|
||||
late RenderingScheduler<ObjectPoolRefElement> _r;
|
||||
RenderingScheduler<ObjectPoolRefElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ObjectPoolRefElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.IsolateRef _isolate;
|
||||
late M.ObjectPoolRef _pool;
|
||||
M.IsolateRef _isolate;
|
||||
M.ObjectPoolRef _pool;
|
||||
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
M.ObjectPoolRef get pool => _pool;
|
||||
|
||||
factory ObjectPoolRefElement(M.IsolateRef isolate, M.ObjectPoolRef pool,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(isolate != null);
|
||||
assert(pool != null);
|
||||
ObjectPoolRefElement e = new ObjectPoolRefElement.created();
|
||||
|
|
|
@ -36,21 +36,21 @@ class ObjectPoolViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ObjectPoolViewElement> _r;
|
||||
RenderingScheduler<ObjectPoolViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ObjectPoolViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
late M.ObjectPool _pool;
|
||||
late M.ObjectPoolRepository _pools;
|
||||
late M.RetainedSizeRepository _retainedSizes;
|
||||
late M.ReachableSizeRepository _reachableSizes;
|
||||
late M.InboundReferencesRepository _references;
|
||||
late M.RetainingPathRepository _retainingPaths;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.ObjectPool _pool;
|
||||
M.ObjectPoolRepository _pools;
|
||||
M.RetainedSizeRepository _retainedSizes;
|
||||
M.ReachableSizeRepository _reachableSizes;
|
||||
M.InboundReferencesRepository _references;
|
||||
M.RetainingPathRepository _retainingPaths;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -69,7 +69,7 @@ class ObjectPoolViewElement extends CustomElement implements Renderable {
|
|||
M.InboundReferencesRepository references,
|
||||
M.RetainingPathRepository retainingPaths,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
@ -122,7 +122,7 @@ class ObjectPoolViewElement extends CustomElement implements Renderable {
|
|||
(new NavRefreshElement(queue: _r.queue)
|
||||
..onRefresh.listen((e) async {
|
||||
e.element.disabled = true;
|
||||
_pool = await _pools.get(_isolate, _pool.id!);
|
||||
_pool = await _pools.get(_isolate, _pool.id);
|
||||
_r.dirty();
|
||||
}))
|
||||
.element,
|
||||
|
@ -138,10 +138,10 @@ class ObjectPoolViewElement extends CustomElement implements Renderable {
|
|||
queue: _r.queue)
|
||||
.element,
|
||||
new HRElement(),
|
||||
new HeadingElement.h3()..text = 'entries (${_pool.entries!.length})',
|
||||
new HeadingElement.h3()..text = 'entries (${_pool.entries.length})',
|
||||
new DivElement()
|
||||
..classes = ['memberList']
|
||||
..children = _pool.entries!
|
||||
..children = _pool.entries
|
||||
.map<Element>((entry) => new DivElement()
|
||||
..classes = ['memberItem']
|
||||
..children = <Element>[
|
||||
|
@ -167,12 +167,12 @@ class ObjectPoolViewElement extends CustomElement implements Renderable {
|
|||
case M.ObjectPoolEntryKind.immediate:
|
||||
return [
|
||||
new SpanElement()
|
||||
..text = 'Immediate 0x${entry.asInteger!.toRadixString(16)}'
|
||||
..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}'
|
||||
];
|
||||
case M.ObjectPoolEntryKind.nativeEntry:
|
||||
return [
|
||||
new SpanElement()
|
||||
..text = 'NativeEntry 0x${entry.asInteger!.toRadixString(16)}'
|
||||
..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}'
|
||||
];
|
||||
}
|
||||
throw new Exception('Unknown ObjectPoolEntryKind (${entry.kind})');
|
||||
|
|
|
@ -31,17 +31,17 @@ class ObjectStoreViewElement extends CustomElement implements Renderable {
|
|||
ViewFooterElement.tag
|
||||
]);
|
||||
|
||||
late RenderingScheduler<ObjectStoreViewElement> _r;
|
||||
RenderingScheduler<ObjectStoreViewElement> _r;
|
||||
|
||||
Stream<RenderedEvent<ObjectStoreViewElement>> get onRendered => _r.onRendered;
|
||||
|
||||
late M.VM _vm;
|
||||
late M.IsolateRef _isolate;
|
||||
late M.EventRepository _events;
|
||||
late M.NotificationRepository _notifications;
|
||||
M.ObjectStore? _store;
|
||||
late M.ObjectStoreRepository _stores;
|
||||
late M.ObjectRepository _objects;
|
||||
M.VM _vm;
|
||||
M.IsolateRef _isolate;
|
||||
M.EventRepository _events;
|
||||
M.NotificationRepository _notifications;
|
||||
M.ObjectStore _store;
|
||||
M.ObjectStoreRepository _stores;
|
||||
M.ObjectRepository _objects;
|
||||
|
||||
M.VMRef get vm => _vm;
|
||||
M.IsolateRef get isolate => _isolate;
|
||||
|
@ -54,7 +54,7 @@ class ObjectStoreViewElement extends CustomElement implements Renderable {
|
|||
M.NotificationRepository notifications,
|
||||
M.ObjectStoreRepository stores,
|
||||
M.ObjectRepository objects,
|
||||
{RenderingQueue? queue}) {
|
||||
{RenderingQueue queue}) {
|
||||
assert(vm != null);
|
||||
assert(isolate != null);
|
||||
assert(events != null);
|
||||
|
|
|
@ -14,7 +14,7 @@ class ObservatoryApplicationElement extends CustomElement {
|
|||
static const tag =
|
||||
const Tag<ObservatoryApplicationElement>('observatory-application');
|
||||
|
||||
late ObservatoryApplication app;
|
||||
ObservatoryApplication app;
|
||||
|
||||
ObservatoryApplicationElement.created() : super.created(tag);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue