From 66aca8a36e0a18abd56f9509329ce445451ee4fc Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Wed, 29 Mar 2017 10:31:34 -0700 Subject: [PATCH] Fix many warnings/errors when building Observatory BUG= R=rmacnak@google.com Review-Url: https://codereview.chromium.org/2783933002 . --- .../lib/src/elements/cpu_profile/virtual_tree.dart | 6 ++---- runtime/observatory/lib/src/elements/debugger.dart | 1 - runtime/observatory/lib/src/elements/isolate_view.dart | 4 ++-- .../lib/src/models/objects/sample_profile.dart | 2 ++ runtime/observatory/lib/src/models/objects/thread.dart | 2 ++ runtime/observatory/lib/src/models/objects/vm.dart | 6 +++++- .../observatory/lib/src/repositories/sample_profile.dart | 4 ++-- runtime/observatory/lib/src/service/object.dart | 9 ++++++--- .../observatory_ui/mocks/objects/heap_snapshot.dart | 2 ++ .../tests/observatory_ui/mocks/objects/isolate.dart | 4 ++++ .../tests/observatory_ui/mocks/objects/vm.dart | 7 +++++++ .../observatory_ui/mocks/repositories/heap_snapshot.dart | 2 +- 12 files changed, 35 insertions(+), 14 deletions(-) diff --git a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart index 3eed1fb738d..00c55b9be3d 100644 --- a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart +++ b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart @@ -49,8 +49,7 @@ class CpuProfileVirtualTreeElement extends HtmlElement implements Renderable { _r.dirty(); } - factory CpuProfileVirtualTreeElement( - M.IsolateRef isolate, 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, @@ -60,7 +59,7 @@ class CpuProfileVirtualTreeElement extends HtmlElement implements Renderable { assert(direction != null); CpuProfileVirtualTreeElement e = document.createElement(tag.name); e._r = new RenderingScheduler(e, queue: queue); - e._isolate = isolate; + e._isolate = owner; e._profile = profile; e._mode = mode; e._type = type; @@ -117,7 +116,6 @@ class CpuProfileVirtualTreeElement extends HtmlElement implements Renderable { break; default: throw new Exception('Unknown SampleProfileType: $type'); - break; } if (filters != null) { tree = filters.fold(tree, (tree, filter) { diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart index d609ff3c330..9b1cc616dcd 100644 --- a/runtime/observatory/lib/src/elements/debugger.dart +++ b/runtime/observatory/lib/src/elements/debugger.dart @@ -452,7 +452,6 @@ class ReloadCommand extends DebuggerCommand { await debugger.refreshStack(); } on S.ServerRpcException catch (e) { if (e.code == S.ServerRpcException.kIsolateReloadBarred || - e.code == S.ServerRpcException.kIsolateReloadFailed || e.code == S.ServerRpcException.kIsolateIsReloading) { debugger.console.printRed(e.data['details']); } else { diff --git a/runtime/observatory/lib/src/elements/isolate_view.dart b/runtime/observatory/lib/src/elements/isolate_view.dart index c82a305edd3..f09f0422d9a 100644 --- a/runtime/observatory/lib/src/elements/isolate_view.dart +++ b/runtime/observatory/lib/src/elements/isolate_view.dart @@ -134,7 +134,7 @@ class IsolateViewElement extends HtmlElement implements Renderable { void render() { final uptime = new DateTime.now().difference(_isolate.startTime); final libraries = _isolate.libraries.toList(); - final List threads = _isolate.threads; + final List threads = _isolate.threads; children = [ navBar([ new NavTopMenuElement(queue: _r.queue), @@ -362,7 +362,7 @@ class IsolateViewElement extends HtmlElement implements Renderable { ]; } - DivElement _populateThreadInfo(Thread t) { + DivElement _populateThreadInfo(M.Thread t) { int index = 0; return new DivElement() ..classes = ['indent'] diff --git a/runtime/observatory/lib/src/models/objects/sample_profile.dart b/runtime/observatory/lib/src/models/objects/sample_profile.dart index 1a71bc2260e..ad0d7be5880 100644 --- a/runtime/observatory/lib/src/models/objects/sample_profile.dart +++ b/runtime/observatory/lib/src/models/objects/sample_profile.dart @@ -53,6 +53,8 @@ abstract class FunctionCallTree extends CallTree { abstract class CallTreeNode { double get percentage; + int get inclusiveNativeAllocations; + int get exclusiveNativeAllocations; Iterable get children; } diff --git a/runtime/observatory/lib/src/models/objects/thread.dart b/runtime/observatory/lib/src/models/objects/thread.dart index be461fdf484..8d16a8ce56c 100644 --- a/runtime/observatory/lib/src/models/objects/thread.dart +++ b/runtime/observatory/lib/src/models/objects/thread.dart @@ -20,6 +20,8 @@ abstract class Thread { /// The task type associated with the thread. ThreadKind get kind; + String get kindString; + /// The maximum amount of zone memory in bytes allocated by a thread at a /// given time throughout the entire life of the thread. int get zoneHighWatermark; diff --git a/runtime/observatory/lib/src/models/objects/vm.dart b/runtime/observatory/lib/src/models/objects/vm.dart index 05e1bba8531..f1f50885943 100644 --- a/runtime/observatory/lib/src/models/objects/vm.dart +++ b/runtime/observatory/lib/src/models/objects/vm.dart @@ -13,7 +13,11 @@ abstract class VMRef { String get displayName; } -abstract class VM implements VMRef { +abstract class ServiceObjectOwner { + Future invokeRpc(String method, Map params); +} + +abstract class VM implements VMRef, ServiceObjectOwner { /// Word length on target architecture (e.g. 32, 64). int get architectureBits; diff --git a/runtime/observatory/lib/src/repositories/sample_profile.dart b/runtime/observatory/lib/src/repositories/sample_profile.dart index f98e0159d8b..02d0f609d40 100644 --- a/runtime/observatory/lib/src/repositories/sample_profile.dart +++ b/runtime/observatory/lib/src/repositories/sample_profile.dart @@ -32,7 +32,7 @@ class SampleProfileLoadingProgress extends M.SampleProfileLoadingProgress { Stream get onProgress => _onProgress.stream; - final ServiceObjectOwner owner; + final M.ServiceObjectOwner owner; final S.Class cls; final M.SampleProfileTag tag; final bool clear; @@ -174,7 +174,7 @@ class NativeMemorySampleProfileRepository SampleProfileLoadingProgress _last; Stream get(M.VM vm, M.SampleProfileTag t, - {bool forceFetch: false}) { + {bool forceFetch: false, bool clear: false}) { assert(forceFetch != null); if ((_last != null) && !forceFetch) { _last.reuse(); diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart index 2dcc7e4a974..8b8c332a220 100644 --- a/runtime/observatory/lib/src/service/object.dart +++ b/runtime/observatory/lib/src/service/object.dart @@ -441,7 +441,8 @@ class RetainingObject implements M.RetainingObject { RetainingObject(this.object); } -abstract class ServiceObjectOwner extends ServiceObject { +abstract class ServiceObjectOwner extends ServiceObject + implements M.ServiceObjectOwner { /// Creates an empty [ServiceObjectOwner]. ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); @@ -449,6 +450,8 @@ abstract class ServiceObjectOwner extends ServiceObject { /// The result may come from the cache. The result will not necessarily /// be [loaded]. ServiceObject getFromMap(Map map); + + Future invokeRpc(String method, Map params); } abstract class Location implements M.Location { @@ -832,7 +835,7 @@ abstract class VM extends ServiceObjectOwner implements M.VM { }); } - Future invokeRpc(String method, Map params) { + Future invokeRpc(String method, Map params) { return invokeRpcNoUpgrade(method, params).then((Map response) { var obj = new ServiceObject._fromMap(this, response); if ((obj != null) && obj.canCache) { @@ -1465,7 +1468,7 @@ class Isolate extends ServiceObjectOwner implements M.Isolate { return vm.invokeRpcNoUpgrade(method, params); } - Future invokeRpc(String method, Map params) { + Future invokeRpc(String method, Map params) { return invokeRpcNoUpgrade(method, params).then((Map response) { return getFromMap(response); }); diff --git a/runtime/observatory/tests/observatory_ui/mocks/objects/heap_snapshot.dart b/runtime/observatory/tests/observatory_ui/mocks/objects/heap_snapshot.dart index d0b268d6a53..38cde90adeb 100644 --- a/runtime/observatory/tests/observatory_ui/mocks/objects/heap_snapshot.dart +++ b/runtime/observatory/tests/observatory_ui/mocks/objects/heap_snapshot.dart @@ -10,6 +10,7 @@ class HeapSnapshotMock implements M.HeapSnapshot { final int references; final int size; final M.HeapSnapshotDominatorNode dominatorTree; + final M.HeapSnapshotMergedDominatorNode mergedDominatorTree = null; final Iterable classReferences; const HeapSnapshotMock( @@ -24,6 +25,7 @@ class HeapSnapshotMock implements M.HeapSnapshot { class HeapSnapshotDominatorNodeMock implements M.HeapSnapshotDominatorNode { final int shallowSize; final int retainedSize; + final bool isStack = false; final Future object; final Iterable children; diff --git a/runtime/observatory/tests/observatory_ui/mocks/objects/isolate.dart b/runtime/observatory/tests/observatory_ui/mocks/objects/isolate.dart index c501e8a4646..1e325fb19fd 100644 --- a/runtime/observatory/tests/observatory_ui/mocks/objects/isolate.dart +++ b/runtime/observatory/tests/observatory_ui/mocks/objects/isolate.dart @@ -28,6 +28,10 @@ class IsolateMock implements M.Isolate { final M.DebugEvent pauseEvent; final M.LibraryRef rootLibrary; final M.FunctionRef entry; + final Iterable threads = null; + final int zoneHighWatermark = 0; + final int numZoneHandles = 0; + final int numScopedHandles = 0; const IsolateMock( {this.id: 'i-id', diff --git a/runtime/observatory/tests/observatory_ui/mocks/objects/vm.dart b/runtime/observatory/tests/observatory_ui/mocks/objects/vm.dart index 0d604730a54..1b9db5591fb 100644 --- a/runtime/observatory/tests/observatory_ui/mocks/objects/vm.dart +++ b/runtime/observatory/tests/observatory_ui/mocks/objects/vm.dart @@ -21,6 +21,13 @@ class VMMock implements M.VM { final int maxRSS; final DateTime startTime; final Iterable isolates; + final int nativeZoneMemoryUsage = 0; + final int heapAllocatedMemoryUsage = 0; + final int heapAllocationCount = 0; + + Future invokeRpc(String method, Map params) { + return null; + } const VMMock( {this.name: 'vm-name', diff --git a/runtime/observatory/tests/observatory_ui/mocks/repositories/heap_snapshot.dart b/runtime/observatory/tests/observatory_ui/mocks/repositories/heap_snapshot.dart index d79ea9f983a..de7dec0e0e4 100644 --- a/runtime/observatory/tests/observatory_ui/mocks/repositories/heap_snapshot.dart +++ b/runtime/observatory/tests/observatory_ui/mocks/repositories/heap_snapshot.dart @@ -38,7 +38,7 @@ class HeapSnapshotRepositoryMock implements M.HeapSnapshotRepository { final HeapSnapshotRepositoryMockCallback _get; Stream get(M.IsolateRef isolate, - {bool gc: false}) { + {M.HeapSnapshotRoots roots: M.HeapSnapshotRoots.vm, bool gc: false}) { if (_get != null) { return _get(isolate, gc); }