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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/script_view.dart

Issue 143973005: Code coverage in Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
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_view_element; 5 library script_view_element;
6 6
7 import 'dart:html';
8 import 'package:logging/logging.dart';
7 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
8 import 'observatory_element.dart'; 10 import 'observatory_element.dart';
9 11
10 /// Displays an Error response. 12 /// Displays an Error response.
11 @CustomTag('script-view') 13 @CustomTag('script-view')
12 class ScriptViewElement extends ObservatoryElement { 14 class ScriptViewElement extends ObservatoryElement {
13 @published Map script; 15 @published Script script;
16
17 String hitsStyle(ScriptLine line) {
18 if (line.hits == -1) {
19 return 'min-width:32px;';
20 } else if (line.hits == 0) {
21 return 'min-width:32px;background-color:red';
22 }
23 return 'min-width:32px;background-color:green';
24 }
25
26 void refreshCoverage(Event e, var detail, Node target) {
27 var isolateId = app.locationManager.currentIsolateId();
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');
36 isolate.updateCoverage(coverage['coverage']);
37 notifyPropertyChange(#hitsStyle, "", hitsStyle);
38 }).catchError((e, st) {
39 print('refreshCoverage $e $st');
40 });
41 }
14 42
15 ScriptViewElement.created() : super.created(); 43 ScriptViewElement.created() : super.created();
16 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698