Chromium Code Reviews| 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 0129c3483241971b0cf60005fb511c885deb1f34..ad90277bb1a4718197d0a8950fcc3402c08d40b3 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); |
| @@ -48,16 +51,9 @@ abstract class Page extends Observable { |
| } |
| /// A [SimplePage] matches a single uri path and displays a single element. |
|
Cutch
2016/08/02 15:52:19
fix documentation comment
cbernaschina
2016/08/02 17:40:24
Done.
|
| -class SimplePage extends Page { |
| +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); |
| @@ -217,19 +225,33 @@ 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.vm.changes.map((_) { |
| + return new VMUpdateEventMock(vm: isolate.vm); |
|
Cutch
2016/08/02 15:52:19
why are mocks present here?
cbernaschina
2016/08/02 17:40:24
I'm building up another CL where all the Events co
|
| + }), isolate, isolate.vm.changes.map((_) { |
| + return new IsolateUpdateEventMock(isolate: isolate); |
| + }), |
| + _isolateSampleProfileRepository, |
| + app.notifications) |
| + ]; |
| }); |
| } |
| + |
| + void onInstall() { |
| + if (element == null) { |
| + element = container; |
| + } |
| + assert(element != null); |
| + } |
| } |
| class TableCpuProfilerPage extends SimplePage { |