| Index: runtime/observatory/lib/src/elements/objectpool_view.dart
|
| diff --git a/runtime/observatory/lib/src/elements/objectpool_view.dart b/runtime/observatory/lib/src/elements/objectpool_view.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9bc5a4e666184e119af9b94034223dbf0382075c
|
| --- /dev/null
|
| +++ b/runtime/observatory/lib/src/elements/objectpool_view.dart
|
| @@ -0,0 +1,43 @@
|
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +library objectpool_view;
|
| +
|
| +import 'dart:async';
|
| +import 'observatory_element.dart';
|
| +import 'package:observatory/service.dart';
|
| +import 'package:polymer/polymer.dart';
|
| +
|
| +@CustomTag('objectpool-view')
|
| +class ObjectPoolViewElement extends ObservatoryElement {
|
| + @published ObjectPool pool;
|
| + @published List annotatedEntries;
|
| +
|
| + ObjectPoolViewElement.created() : super.created();
|
| +
|
| + bool isServiceObject(o) => o is ServiceObject;
|
| +
|
| + void poolChanged(oldValue) {
|
| + annotateRawEntries();
|
| + }
|
| +
|
| + Future annotateRawEntries() {
|
| + var tasks = pool.entries.map((entry) {
|
| + if (entry is int) {
|
| + var addr = entry.toRadixString(16);
|
| + return pool.isolate.getObjectByAddress(addr).then((result) {
|
| + return result is ServiceObject ? result : null;
|
| + });
|
| + } else {
|
| + return new Future.value(null);
|
| + }
|
| + });
|
| +
|
| + return Future.wait(tasks).then((results) => annotatedEntries = results);
|
| + }
|
| +
|
| + Future refresh() {
|
| + return pool.reload().then((_) => annotateRawEntries());
|
| + }
|
| +}
|
|
|