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

Side by Side Diff: runtime/observatory/lib/src/elements/script_inset.dart

Issue 1039863002: Call site data UI tweaks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library script_inset_element; 5 library script_inset_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'service_ref.dart'; 10 import 'service_ref.dart';
11 import 'package:observatory/service.dart'; 11 import 'package:observatory/service.dart';
12 import 'package:polymer/polymer.dart'; 12 import 'package:polymer/polymer.dart';
13 13
14 const nbsp = "\u00A0"; 14 const nbsp = "\u00A0";
15 15
16 void addInfoBox(content, infoBox) { 16 void addInfoBox(content, infoBox) {
17 infoBox.style.position = 'absolute'; 17 infoBox.style.position = 'absolute';
18 infoBox.style.padding = '1em'; 18 infoBox.style.padding = '1em';
19 infoBox.style.border = 'solid black 2px'; 19 infoBox.style.border = 'solid black 2px';
20 infoBox.style.zIndex = '10'; 20 infoBox.style.zIndex = '10';
21 infoBox.style.backgroundColor = 'white'; 21 infoBox.style.backgroundColor = 'white';
22 22 infoBox.style.cursor = 'auto';
23 infoBox.style.display = 'none'; // Initially hidden. 23 infoBox.style.display = 'none'; // Initially hidden.
24 24
25 var show = false; 25 var show = false;
26 content.onClick.listen((event) { 26 content.onClick.listen((event) {
27 show = !show; 27 show = !show;
28 infoBox.style.display = show ? 'block' : 'none'; 28 infoBox.style.display = show ? 'block' : 'none';
29 content.style.backgroundColor = show ? 'white' : '';
29 }); 30 });
30 31
31 // Causes infoBox to be positioned relative to the bottom-left of content. 32 // Causes infoBox to be positioned relative to the bottom-left of content.
32 content.style.display = 'inline-block'; 33 content.style.display = 'inline-block';
34 content.style.cursor = 'pointer';
33 content.append(infoBox); 35 content.append(infoBox);
34 } 36 }
35 37
36 abstract class Annotation { 38 abstract class Annotation {
37 int line; 39 int line;
38 int columnStart; 40 int columnStart;
39 int columnStop; 41 int columnStop;
40 42
41 void applyStyleTo(element); 43 void applyStyleTo(element);
42 } 44 }
43 45
44 class CurrentExecutionAnnotation extends Annotation { 46 class CurrentExecutionAnnotation extends Annotation {
45 void applyStyleTo(element) { 47 void applyStyleTo(element) {
46 if (element == null) { 48 if (element == null) {
47 return; // TODO(rmacnak): Handling overlapping annotations. 49 return; // TODO(rmacnak): Handling overlapping annotations.
48 } 50 }
49 element.classes.add("currentCol"); 51 element.classes.add("currentCol");
50 element.title = "Current execution"; 52 element.title = "Current execution";
51 } 53 }
52 } 54 }
53 55
54 class CallSiteAnnotation extends Annotation { 56 class CallSiteAnnotation extends Annotation {
55 CallSite callSite; 57 CallSite callSite;
56 58
57 Element row() { 59 Element row([content]) {
58 var e = new DivElement(); 60 var e = new DivElement();
59 e.style.display = "table-row"; 61 e.style.display = "table-row";
62 if (content is String) e.text = content;
60 return e; 63 return e;
61 } 64 }
62 65
63 Element cell(content) { 66 Element cell(content) {
64 var e = new DivElement(); 67 var e = new DivElement();
65 e.style.display = "table-cell"; 68 e.style.display = "table-cell";
66 e.style.padding = "3px"; 69 e.style.padding = "3px";
67 if (content is String) e.text = content; 70 if (content is String) e.text = content;
68 if (content is Element) e.children.add(content); 71 if (content is Element) e.children.add(content);
69 return e; 72 return e;
70 } 73 }
71 74
72 Element serviceRef(object) { 75 Element serviceRef(object) {
73 AnyServiceRefElement e = new Element.tag("any-service-ref"); 76 AnyServiceRefElement e = new Element.tag("any-service-ref");
74 e.ref = object; 77 e.ref = object;
75 return e; 78 return e;
76 } 79 }
77 80
78 Element entriesTable() { 81 Element entriesTable() {
79 var e = new DivElement(); 82 var e = new DivElement();
80 e.style.display = "table"; 83 e.style.display = "table";
81 e.style.color = "#333"; 84 e.style.color = "#333";
82 e.style.font = "400 14px 'Montserrat', sans-serif"; 85 e.style.font = "400 14px 'Montserrat', sans-serif";
83 86
84 var r = row(); 87 if (callSite.entries.isEmpty) {
85 r.append(cell("Container")); 88 e.append(row('Did not execute'));
86 r.append(cell("Count")); 89 } else {
87 r.append(cell("Target")); 90 var r = row();
88 e.append(r); 91 r.append(cell("Container"));
92 r.append(cell("Count"));
93 r.append(cell("Target"));
94 e.append(r);
89 95
90 for (var entry in callSite.entries) { 96 for (var entry in callSite.entries) {
91 var r = row(); 97 var r = row();
92 r.append(cell(serviceRef(entry.receiverContainer))); 98 r.append(cell(serviceRef(entry.receiverContainer)));
93 r.append(cell(entry.count.toString())); 99 r.append(cell(entry.count.toString()));
94 r.append(cell(serviceRef(entry.target))); 100 r.append(cell(serviceRef(entry.target)));
95 e.append(r); 101 e.append(r);
102 }
96 } 103 }
97 104
98 return e; 105 return e;
99 } 106 }
100 107
101 void applyStyleTo(element) { 108 void applyStyleTo(element) {
102 if (element == null) { 109 if (element == null) {
103 return; // TODO(rmacnak): Handling overlapping annotations. 110 return; // TODO(rmacnak): Handling overlapping annotations.
104 } 111 }
105 element.style.fontWeight = "bold"; 112 element.style.fontWeight = "bold";
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 pending.add(line.script.isolate.removeBreakpoint(bpt)); 407 pending.add(line.script.isolate.removeBreakpoint(bpt));
401 } 408 }
402 Future.wait(pending).then((_) { 409 Future.wait(pending).then((_) {
403 busy = false; 410 busy = false;
404 }); 411 });
405 } 412 }
406 } 413 }
407 414
408 BreakpointToggleElement.created() : super.created(); 415 BreakpointToggleElement.created() : super.created();
409 } 416 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698