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

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: fjkdls 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..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);

Powered by Google App Engine
This is Rietveld 408576698