Chromium Code Reviews| 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_view_element; | 5 library script_view_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:logging/logging.dart'; | 8 import 'isolate_element.dart'; |
| 9 import 'package:observatory/app.dart'; | |
| 9 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
| 10 import 'observatory_element.dart'; | |
| 11 | 11 |
| 12 /// Displays an Error response. | 12 /// Displays an Error response. |
| 13 @CustomTag('script-view') | 13 @CustomTag('script-view') |
| 14 class ScriptViewElement extends ObservatoryElement { | 14 class ScriptViewElement extends IsolateElement { |
| 15 @published Script script; | 15 @published Script script; |
| 16 | 16 |
| 17 ScriptViewElement.created() : super.created(); | |
| 18 | |
| 17 String hitsStyle(ScriptLine line) { | 19 String hitsStyle(ScriptLine line) { |
| 18 if (line.hits == -1) { | 20 if (line.hits == -1) { |
| 19 return 'min-width:32px;'; | 21 return 'min-width:32px;'; |
| 20 } else if (line.hits == 0) { | 22 } else if (line.hits == 0) { |
| 21 return 'min-width:32px;background-color:red'; | 23 return 'min-width:32px;background-color:red'; |
| 22 } | 24 } |
| 23 return 'min-width:32px;background-color:green'; | 25 return 'min-width:32px;background-color:green'; |
| 24 } | 26 } |
| 25 | 27 |
| 26 void refreshCoverage(Event e, var detail, Node target) { | 28 void refreshCoverage(Event e, var detail, Node target) { |
| 27 var isolateId = app.locationManager.currentIsolateId(); | 29 isolate.getMap('/coverage').then((Map coverage) { |
|
turnidge
2014/03/05 21:02:47
slash here?
Cutch
2014/03/05 21:54:23
Done.
| |
| 28 var isolate = app.isolateManager.getIsolate(isolateId); | |
| 29 if (isolate == null) { | |
| 30 Logger.root.info('No isolate found.'); | |
| 31 return; | |
| 32 } | |
| 33 var request = '/$isolateId/coverage'; | |
| 34 app.requestManager.requestMap(request).then((Map coverage) { | |
| 35 assert(coverage['type'] == 'CodeCoverage'); | 30 assert(coverage['type'] == 'CodeCoverage'); |
| 36 isolate.updateCoverage(coverage['coverage']); | 31 isolate.updateCoverage(coverage['coverage']); |
| 37 notifyPropertyChange(#hitsStyle, "", hitsStyle); | 32 notifyPropertyChange(#hitsStyle, "", hitsStyle); |
| 38 }).catchError((e, st) { | 33 }).catchError((e, st) { |
| 39 print('refreshCoverage $e $st'); | 34 print('refreshCoverage $e $st'); |
| 40 }); | 35 }); |
| 41 } | 36 } |
| 42 | 37 |
| 43 ScriptViewElement.created() : super.created(); | 38 |
| 44 } | 39 } |
| OLD | NEW |