| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 domain.execution; | 5 library domain.execution; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core'; | 9 import 'dart:core'; |
| 10 | 10 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return new ExecutionMapUriResult(file: file).toResponse(request.id); | 152 return new ExecutionMapUriResult(file: file).toResponse(request.id); |
| 153 } | 153 } |
| 154 return new Response.invalidParameter( | 154 return new Response.invalidParameter( |
| 155 request, 'file', 'Either file or uri must be provided'); | 155 request, 'file', 'Either file or uri must be provided'); |
| 156 } | 156 } |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Implement the 'execution.setSubscriptions' request. | 159 * Implement the 'execution.setSubscriptions' request. |
| 160 */ | 160 */ |
| 161 Response setSubscriptions(Request request) { | 161 Response setSubscriptions(Request request) { |
| 162 if (server.options.enableNewAnalysisDriver) { | 162 List<ExecutionService> subscriptions = |
| 163 return new ExecutionSetSubscriptionsResult().toResponse(request.id); | 163 new ExecutionSetSubscriptionsParams.fromRequest(request).subscriptions; |
| 164 if (subscriptions.contains(ExecutionService.LAUNCH_DATA)) { |
| 165 if (onFileAnalyzed == null) { |
| 166 onFileAnalyzed = server.onFileAnalyzed.listen(_fileAnalyzed); |
| 167 _reportCurrentFileStatus(); |
| 168 } |
| 164 } else { | 169 } else { |
| 165 List<ExecutionService> subscriptions = | 170 if (onFileAnalyzed != null) { |
| 166 new ExecutionSetSubscriptionsParams.fromRequest(request).subscriptions
; | 171 onFileAnalyzed.cancel(); |
| 167 if (subscriptions.contains(ExecutionService.LAUNCH_DATA)) { | 172 onFileAnalyzed = null; |
| 168 if (onFileAnalyzed == null) { | |
| 169 onFileAnalyzed = server.onFileAnalyzed.listen(_fileAnalyzed); | |
| 170 _reportCurrentFileStatus(); | |
| 171 } | |
| 172 } else { | |
| 173 if (onFileAnalyzed != null) { | |
| 174 onFileAnalyzed.cancel(); | |
| 175 onFileAnalyzed = null; | |
| 176 } | |
| 177 } | 173 } |
| 178 return new ExecutionSetSubscriptionsResult().toResponse(request.id); | |
| 179 } | 174 } |
| 175 return new ExecutionSetSubscriptionsResult().toResponse(request.id); |
| 180 } | 176 } |
| 181 | 177 |
| 182 void _fileAnalyzed(ChangeNotice notice) { | 178 void _fileAnalyzed(ChangeNotice notice) { |
| 183 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() { | 179 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() { |
| 184 Source source = notice.source; | 180 Source source = notice.source; |
| 185 String filePath = source.fullName; | 181 String filePath = source.fullName; |
| 186 // check files | 182 // check files |
| 187 bool isDartFile = notice.resolvedDartUnit != null; | 183 bool isDartFile = notice.resolvedDartUnit != null; |
| 188 if (!isDartFile) { | 184 if (!isDartFile) { |
| 189 return; | 185 return; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (_isInAnalysisRoot(filePath)) { | 255 if (_isInAnalysisRoot(filePath)) { |
| 260 server.sendNotification( | 256 server.sendNotification( |
| 261 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification()); | 257 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification()); |
| 262 } | 258 } |
| 263 } | 259 } |
| 264 | 260 |
| 265 static List<String> _getFullNames(List<Source> sources) { | 261 static List<String> _getFullNames(List<Source> sources) { |
| 266 return sources.map((Source source) => source.fullName).toList(); | 262 return sources.map((Source source) => source.fullName).toList(); |
| 267 } | 263 } |
| 268 } | 264 } |
| OLD | NEW |