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

Unified Diff: runtime/observatory/lib/src/elements/timeline_page.dart

Issue 1406413006: Timeline service protocol support with Observatory UI (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/src/app/page.dart ('k') | runtime/observatory/lib/src/elements/timeline_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/timeline_page.dart
diff --git a/runtime/observatory/lib/src/elements/timeline_page.dart b/runtime/observatory/lib/src/elements/timeline_page.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2d7049ffb51ee98c05b047757e28769786af03c7
--- /dev/null
+++ b/runtime/observatory/lib/src/elements/timeline_page.dart
@@ -0,0 +1,78 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library timeline_page_element;
+
+import 'dart:async';
+import 'dart:convert';
+import 'dart:html';
+import 'observatory_element.dart';
+import 'package:observatory/app.dart';
+import 'package:observatory/service_html.dart';
+import 'package:polymer/polymer.dart';
+
+
+@CustomTag('timeline-page')
+class TimelinePageElement extends ObservatoryElement {
+ TimelinePageElement.created() : super.created();
+
+ attached() {
+ super.attached();
+ _resizeSubscription = window.onResize.listen((_) => _updateSize());
+ _updateSize();
+ }
+
+ detached() {
+ super.detached();
+ if (_resizeSubscription != null) {
+ _resizeSubscription.cancel();
+ }
+ }
+
+ Future postMessage(String method) {
+ IFrameElement e = $['root'];
+ var message = {
+ 'method': method,
+ 'params': {
+ 'vmAddress': (app.vm as WebSocketVM).target.networkAddress
+ }
+ };
+ e.contentWindow.postMessage(JSON.encode(message), window.location.href);
+ return null;
+ }
+
+ Future refresh() async {
+ return postMessage('refresh');
+ }
+
+ Future clear() async {
+ await app.vm.invokeRpc('_clearVMTimeline', {});
+ return postMessage('clear');
+ }
+
+ Future recordOn() async {
+ return app.vm.invokeRpc('_setVMTimelineFlag', {
+ '_record': 'all',
+ });
+ }
+
+ Future recordOff() async {
+ return app.vm.invokeRpc('_setVMTimelineFlag', {
+ '_record': 'none',
+ });
+ }
+
+ _updateSize() {
+ IFrameElement e = $['root'];
+ final totalHeight = window.innerHeight;
+ final top = e.offset.top;
+ final bottomMargin = 32;
+ final mainHeight = totalHeight - top - bottomMargin;
+ e.style.setProperty('height', '${mainHeight}px');
+ e.style.setProperty('width', '100%');
+ }
+
+
+ StreamSubscription _resizeSubscription;
+}
« no previous file with comments | « runtime/observatory/lib/src/app/page.dart ('k') | runtime/observatory/lib/src/elements/timeline_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698