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

Unified Diff: runtime/bin/vmservice/client/lib/src/elements/script_inset.dart

Issue 381383010: Add breakpoints and single-stepping to Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix bugs, gen js Created 6 years, 5 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/bin/vmservice/client/lib/src/elements/script_inset.dart
diff --git a/runtime/bin/vmservice/client/lib/src/elements/script_inset.dart b/runtime/bin/vmservice/client/lib/src/elements/script_inset.dart
index d697983f1baae7f549f7bd113e46e142f4750edf..814c45f61988a8e9b18b84bb7c6f26fca738a71b 100644
--- a/runtime/bin/vmservice/client/lib/src/elements/script_inset.dart
+++ b/runtime/bin/vmservice/client/lib/src/elements/script_inset.dart
@@ -25,6 +25,7 @@ class ScriptInsetElement extends ObservatoryElement {
@observable int currentLine;
@observable int startLine;
@observable int endLine;
+ @observable bool linesReady = false;
@observable List<ScriptLine> lines = toObservable([]);
@@ -34,11 +35,15 @@ class ScriptInsetElement extends ObservatoryElement {
MutationObserver _observer;
- void _onMutation(mutations, observer) {
+ void _scrollToCurrentPos() {
var line = shadowRoot.querySelector('#line-$currentLine');
if (line != null) {
line.scrollIntoView();
}
+ }
+
+ void _onMutation(mutations, observer) {
+ _scrollToCurrentPos();
}
void attached() {
@@ -60,6 +65,7 @@ class ScriptInsetElement extends ObservatoryElement {
void currentPosChanged(oldValue) {
_updateLines();
+ _scrollToCurrentPos();
}
void startPosChanged(oldValue) {
@@ -77,6 +83,7 @@ class ScriptInsetElement extends ObservatoryElement {
var _updateFuture;
void _updateLines() {
+ linesReady = false;
if (_updateFuture != null) {
// Already scheduled.
return;
@@ -103,11 +110,39 @@ class ScriptInsetElement extends ObservatoryElement {
endLine = (endPos != null
? script.tokenToLine(endPos)
: script.lines.length);
+
lines.clear();
for (int i = (startLine - 1); i <= (endLine - 1); i++) {
lines.add(script.lines[i]);
}
+ linesReady = true;
}
ScriptInsetElement.created() : super.created();
}
+
+@CustomTag('breakpoint-toggle')
+class BreakpointToggleElement extends ObservatoryElement {
+ @published ScriptLine line;
+ @observable bool busy = false;
+
+ void toggleBreakpoint(var a, var b, var c) {
+ if (busy) {
+ return;
+ }
+ busy = true;
+ if (line.bpt == null) {
+ // No breakpoint. Set it.
+ line.script.isolate.setBreakpoint(line.script, line.line).then((_) {
+ busy = false;
+ });
+ } else {
+ // Existing breakpoint. Remove it.
+ line.script.isolate.clearBreakpoint(line.bpt).then((_) {
+ busy = false;
+ });
+ }
+ }
+
+ BreakpointToggleElement.created() : super.created();
+}

Powered by Google App Engine
This is Rietveld 408576698