Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Unified Diff: runtime/observatory/lib/src/app/page.dart

Issue 823403004: Begin migrating the vm service from a rest-style interface to a json-rpc style interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove old-style standalone tests. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..02f4b2f7099f870ddc781871bbdee48112554bbb 100644
--- a/runtime/observatory/lib/src/app/page.dart
+++ b/runtime/observatory/lib/src/app/page.dart
@@ -88,6 +88,9 @@ class ClassTreePage extends Page {
assert(canVisit(url));
// ClassTree urls are 'class-tree/isolate-id', chop off prefix, leaving
// isolate url.
+ //
+ // TODO(turnidge): Many pages share the isolate parsing/fetching
+ // code. Consider refactoring.
url = url.substring(_urlPrefix.length);
/// Request the isolate url.
app.vm.get(url).then((isolate) {
@@ -138,6 +141,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.
+ 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);
« no previous file with comments | « runtime/observatory/lib/src/app/application.dart ('k') | runtime/observatory/lib/src/elements/class_view.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698