| 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 isolate_profile_element; | 5 library isolate_profile_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 9 import 'package:observatory/observatory.dart'; | 9 import 'package:observatory/observatory.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 methodCountSelectedChanged(oldValue) { | 84 methodCountSelectedChanged(oldValue) { |
| 85 var isolateId = app.locationManager.currentIsolateId(); | 85 var isolateId = app.locationManager.currentIsolateId(); |
| 86 var isolate = app.isolateManager.getIsolate(isolateId); | 86 var isolate = app.isolateManager.getIsolate(isolateId); |
| 87 if (isolate == null) { | 87 if (isolate == null) { |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 _refresh(isolate); | 90 _refresh(isolate); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void refreshData(Event e, var detail, Node target) { | 93 void refresh(var done) { |
| 94 var isolateId = app.locationManager.currentIsolateId(); | 94 var isolateId = app.locationManager.currentIsolateId(); |
| 95 var isolate = app.isolateManager.getIsolate(isolateId); | 95 var isolate = app.isolateManager.getIsolate(isolateId); |
| 96 if (isolate == null) { | 96 if (isolate == null) { |
| 97 Logger.root.info('No isolate found.'); | 97 Logger.root.info('No isolate found.'); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 var request = '/$isolateId/profile'; | 100 var request = '/$isolateId/profile'; |
| 101 _startRequest(); | 101 _startRequest(); |
| 102 app.requestManager.requestMap(request).then((Map profile) { | 102 app.requestManager.requestMap(request).then((Map profile) { |
| 103 assert(profile['type'] == 'Profile'); | 103 assert(profile['type'] == 'Profile'); |
| 104 var samples = profile['samples']; | 104 var samples = profile['samples']; |
| 105 Logger.root.info('Profile contains ${samples} samples.'); | 105 Logger.root.info('Profile contains ${samples} samples.'); |
| 106 _loadProfileData(isolate, samples, profile); | 106 _loadProfileData(isolate, samples, profile); |
| 107 _endRequest(); | 107 _endRequest(); |
| 108 }).catchError((e) { | 108 }).catchError((e) { |
| 109 _endRequest(); | 109 _endRequest(); |
| 110 }); | 110 }).whenComplete(done); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void _loadProfileData(Isolate isolate, int totalSamples, Map response) { | 113 void _loadProfileData(Isolate isolate, int totalSamples, Map response) { |
| 114 isolate.profile = new Profile.fromMap(isolate, response); | 114 isolate.profile = new Profile.fromMap(isolate, response); |
| 115 _refresh(isolate); | 115 _refresh(isolate); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void _refresh(Isolate isolate) { | 118 void _refresh(Isolate isolate) { |
| 119 _refreshTopMethods(isolate); | 119 _refreshTopMethods(isolate); |
| 120 _refreshTree(isolate); | 120 _refreshTree(isolate); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 @observable void toggleExpanded(Event e, var detail, Element target) { | 154 @observable void toggleExpanded(Event e, var detail, Element target) { |
| 155 var row = target.parent; | 155 var row = target.parent; |
| 156 if (row is TableRowElement) { | 156 if (row is TableRowElement) { |
| 157 // Subtract 1 to get 0 based indexing. | 157 // Subtract 1 to get 0 based indexing. |
| 158 tree.toggle(row.rowIndex - 1); | 158 tree.toggle(row.rowIndex - 1); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| OLD | NEW |