OLD | NEW |
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 'package:observatory/app.dart'; | 9 import 'package:observatory/app.dart'; |
10 import 'package:observatory/models.dart' as M; | 10 import 'package:observatory/models.dart' as M; |
11 import 'package:observatory/service.dart' as S; | 11 import 'package:observatory/service.dart' as S; |
12 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 12 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
14 import 'package:observatory/src/elements/helpers/tag.dart'; | 14 import 'package:observatory/src/elements/helpers/tag.dart'; |
15 import 'package:observatory/src/elements/helpers/uris.dart'; | 15 import 'package:observatory/src/elements/helpers/uris.dart'; |
16 import 'package:observatory/utils.dart'; | 16 import 'package:observatory/utils.dart'; |
17 | 17 |
18 class ScriptInsetElement extends HtmlElement implements Renderable { | 18 class ScriptInsetElement extends HtmlElement implements Renderable { |
19 static const tag = const Tag<ScriptInsetElement>('script-inset-wrapped'); | 19 static const tag = const Tag<ScriptInsetElement>('script-inset'); |
20 | 20 |
21 RenderingScheduler _r; | 21 RenderingScheduler _r; |
22 | 22 |
23 Stream<RenderedEvent<ScriptInsetElement>> get onRendered => _r.onRendered; | 23 Stream<RenderedEvent<ScriptInsetElement>> get onRendered => _r.onRendered; |
24 | 24 |
25 | 25 |
26 M.IsolateRef _isolate; | 26 M.IsolateRef _isolate; |
27 M.ScriptRef _script; | 27 M.ScriptRef _script; |
28 M.Script _loadedScript; | 28 M.Script _loadedScript; |
29 M.ScriptRepository _scripts; | 29 M.ScriptRepository _scripts; |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 if (resolved) { | 768 if (resolved) { |
769 e.classes.add("resolvedBreakpoint"); | 769 e.classes.add("resolvedBreakpoint"); |
770 } else { | 770 } else { |
771 e.classes.add("unresolvedBreakpoint"); | 771 e.classes.add("unresolvedBreakpoint"); |
772 } | 772 } |
773 } else { | 773 } else { |
774 e.classes.add("possibleBreakpoint"); | 774 e.classes.add("possibleBreakpoint"); |
775 } | 775 } |
776 } | 776 } |
777 | 777 |
778 line.changes.listen((_) => update()); | |
779 e.onClick.listen((event) { | 778 e.onClick.listen((event) { |
780 if (busy) { | 779 if (busy) { |
781 return; | 780 return; |
782 } | 781 } |
783 busy = true; | 782 busy = true; |
784 if (line.breakpoints == null) { | 783 if (line.breakpoints == null) { |
785 // No breakpoint. Add it. | 784 // No breakpoint. Add it. |
786 line.script.isolate.addBreakpoint(line.script, line.line) | 785 line.script.isolate.addBreakpoint(line.script, line.line) |
787 .catchError((e, st) { | 786 .catchError((e, st) { |
788 if (e is! S.ServerRpcException || | 787 if (e is! S.ServerRpcException || |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 if (self) { | 1340 if (self) { |
1342 return selfTicks / sampleCount; | 1341 return selfTicks / sampleCount; |
1343 } else { | 1342 } else { |
1344 return totalTicks / sampleCount; | 1343 return totalTicks / sampleCount; |
1345 } | 1344 } |
1346 } | 1345 } |
1347 | 1346 |
1348 bool isHot(bool self) => _percent(self) > kHotThreshold; | 1347 bool isHot(bool self) => _percent(self) > kHotThreshold; |
1349 bool isMedium(bool self) => _percent(self) > kMediumThreshold; | 1348 bool isMedium(bool self) => _percent(self) > kMediumThreshold; |
1350 } | 1349 } |
OLD | NEW |