| Index: runtime/observatory/lib/src/app/page.dart
|
| diff --git a/runtime/observatory/lib/src/app/page.dart b/runtime/observatory/lib/src/app/page.dart
|
| index 460be214761c38d6ba4de6237282058d19655fe7..e5d0b1f836c5a94ca31d24f6e57dffd63ddca766 100644
|
| --- a/runtime/observatory/lib/src/app/page.dart
|
| +++ b/runtime/observatory/lib/src/app/page.dart
|
| @@ -4,6 +4,9 @@
|
|
|
| part of app;
|
|
|
| +IsolateSampleProfileRepository _isolateSampleProfileRepository
|
| + = new IsolateSampleProfileRepository();
|
| +
|
| class IsolateNotFound implements Exception {
|
| String isolateId;
|
| IsolateNotFound(this.isolateId);
|
| @@ -47,17 +50,10 @@ abstract class Page extends Observable {
|
| bool canVisit(Uri uri);
|
| }
|
|
|
| -/// A [SimplePage] matches a single uri path and displays a single element.
|
| -class SimplePage extends Page {
|
| +/// A [MatchingPage] matches a single uri path.
|
| +abstract class MatchingPage extends Page {
|
| final String path;
|
| - final String elementTagName;
|
| - SimplePage(this.path, this.elementTagName, app) : super(app);
|
| -
|
| - void onInstall() {
|
| - if (element == null) {
|
| - element = new Element.tag(elementTagName);
|
| - }
|
| - }
|
| + MatchingPage(this.path, app) : super(app);
|
|
|
| void _visit(Uri uri) {
|
| assert(uri != null);
|
| @@ -77,6 +73,18 @@ class SimplePage extends Page {
|
| bool canVisit(Uri uri) => uri.path == path;
|
| }
|
|
|
| +/// A [SimplePage] matches a single uri path and displays a single element.
|
| +class SimplePage extends MatchingPage {
|
| + final String elementTagName;
|
| + SimplePage(String path, this.elementTagName, app) : super(path, app);
|
| +
|
| + void onInstall() {
|
| + if (element == null) {
|
| + element = new Element.tag(elementTagName);
|
| + }
|
| + }
|
| +}
|
| +
|
| /// Error page for unrecognized paths.
|
| class ErrorPage extends Page {
|
| ErrorPage(app) : super(app);
|
| @@ -216,19 +224,28 @@ class ObjectStorePage extends SimplePage {
|
| }
|
| }
|
|
|
| -class CpuProfilerPage extends SimplePage {
|
| - CpuProfilerPage(app) : super('profiler', 'cpu-profile', app);
|
| +class CpuProfilerPage extends MatchingPage {
|
| + CpuProfilerPage(app) : super('profiler', app);
|
| +
|
| + DivElement container = new DivElement();
|
|
|
| void _visit(Uri uri) {
|
| super._visit(uri);
|
| getIsolate(uri).then((isolate) {
|
| - if (element != null) {
|
| - /// Update the page.
|
| - CpuProfileElement page = element;
|
| - page.isolate = isolate;
|
| - }
|
| + container.children = [
|
| + new CpuProfileElement(isolate.vm, isolate, app.events,
|
| + app.notifications,
|
| + _isolateSampleProfileRepository)
|
| + ];
|
| });
|
| }
|
| +
|
| + void onInstall() {
|
| + if (element == null) {
|
| + element = container;
|
| + }
|
| + assert(element != null);
|
| + }
|
| }
|
|
|
| class TableCpuProfilerPage extends SimplePage {
|
|
|