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

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

Issue 2204563003: Converted Observatory cpu-profile element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master Created 4 years, 4 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
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/app/view_model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/app/view_model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698