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 518946c56fd011a6ad8d75f1a888d95bbb6e1720..d17815a74a489958c40db0150bb83d9c5867b98f 100644 |
| --- a/runtime/observatory/lib/src/app/page.dart |
| +++ b/runtime/observatory/lib/src/app/page.dart |
| @@ -138,6 +138,105 @@ class DebuggerPage extends Page { |
| bool canVisit(String url) => url.startsWith(_urlPrefix); |
| } |
| +class CpuProfilerPage extends Page { |
| + static const _urlPrefix = 'profiler/'; |
| + |
| + CpuProfilerPage(app) : super(app); |
| + |
| + void onInstall() { |
| + if (element == null) { |
| + element = new Element.tag('cpu-profile'); |
| + } |
| + } |
| + |
| + void _visit(String url) { |
| + assert(element != null); |
| + assert(canVisit(url)); |
| + // CpuProfiler urls are 'profiler/isolate-id', chop off prefix, leaving |
| + // isolate url. |
|
Cutch
2015/02/02 22:20:04
Maybe this stripping of isolate out of the URL sho
turnidge
2015/02/02 22:44:05
Added TODO. I'll be touching this code again soon
|
| + url = url.substring(_urlPrefix.length); |
| + /// Request the isolate url. |
| + app.vm.get(url).then((isolate) { |
| + if (element != null) { |
| + /// Update the page. |
| + CpuProfileElement page = element; |
| + page.isolate = isolate; |
| + } |
| + }).catchError((e) { |
| + Logger.root.severe('Unexpected profiler error: $e'); |
| + }); |
| + } |
| + |
| + /// Catch all. |
| + bool canVisit(String url) => url.startsWith(_urlPrefix); |
| +} |
| + |
| +class AllocationProfilerPage extends Page { |
| + static const _urlPrefix = 'allocation-profiler/'; |
| + |
| + AllocationProfilerPage(app) : super(app); |
| + |
| + void onInstall() { |
| + if (element == null) { |
| + element = new Element.tag('heap-profile'); |
| + } |
| + } |
| + |
| + void _visit(String url) { |
| + assert(element != null); |
| + assert(canVisit(url)); |
| + // Allocation profiler urls are 'allocation-profiler/isolate-id', |
| + // chop off prefix, leaving isolate url. |
| + url = url.substring(_urlPrefix.length); |
| + /// Request the isolate url. |
| + app.vm.get(url).then((isolate) { |
| + if (element != null) { |
| + /// Update the page. |
| + HeapProfileElement page = element; |
| + page.isolate = isolate; |
| + } |
| + }).catchError((e) { |
| + Logger.root.severe('Unexpected allocation profiler error: $e'); |
| + }); |
| + } |
| + |
| + /// Catch all. |
| + bool canVisit(String url) => url.startsWith(_urlPrefix); |
| +} |
| + |
| +class HeapMapPage extends Page { |
| + static const _urlPrefix = 'heap-map/'; |
| + |
| + HeapMapPage(app) : super(app); |
| + |
| + void onInstall() { |
| + if (element == null) { |
| + element = new Element.tag('heap-map'); |
| + } |
| + } |
| + |
| + void _visit(String url) { |
| + assert(element != null); |
| + assert(canVisit(url)); |
| + // Allocation profiler urls are 'heap-map/isolate-id', |
| + // chop off prefix, leaving isolate url. |
| + url = url.substring(_urlPrefix.length); |
| + /// Request the isolate url. |
| + app.vm.get(url).then((isolate) { |
| + if (element != null) { |
| + /// Update the page. |
| + HeapMapElement page = element; |
| + page.isolate = isolate; |
| + } |
| + }).catchError((e) { |
| + Logger.root.severe('Unexpected heap map error: $e'); |
| + }); |
| + } |
| + |
| + /// Catch all. |
| + bool canVisit(String url) => url.startsWith(_urlPrefix); |
| +} |
| + |
| class ErrorViewPage extends Page { |
| ErrorViewPage(app) : super(app); |