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

Side by Side Diff: pkg/analysis_server/lib/src/domain_execution.dart

Issue 2713513007: Deprecate execution.setSubscriptions. (Closed)
Patch Set: Merge branch 'master' into deprecate_set_subscriptions Created 3 years, 10 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
OLDNEW
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
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 List<ExecutionService> subscriptions = 162 if (server.options.enableNewAnalysisDriver) {
163 new ExecutionSetSubscriptionsParams.fromRequest(request).subscriptions; 163 // Under the analysis driver, setSubscriptions() becomes a no-op.
164 if (subscriptions.contains(ExecutionService.LAUNCH_DATA)) { 164 return new ExecutionSetSubscriptionsResult().toResponse(request.id);
165 if (onFileAnalyzed == null) { 165 } else {
166 onFileAnalyzed = server.onFileAnalyzed.listen(_fileAnalyzed); 166 List<ExecutionService> subscriptions =
167 _reportCurrentFileStatus(); 167 new ExecutionSetSubscriptionsParams.fromRequest(request).subscriptions ;
168 if (subscriptions.contains(ExecutionService.LAUNCH_DATA)) {
169 if (onFileAnalyzed == null) {
170 onFileAnalyzed = server.onFileAnalyzed.listen(_fileAnalyzed);
171 _reportCurrentFileStatus();
172 }
173 } else {
174 if (onFileAnalyzed != null) {
175 onFileAnalyzed.cancel();
176 onFileAnalyzed = null;
177 }
168 } 178 }
169 } else { 179 return new ExecutionSetSubscriptionsResult().toResponse(request.id);
170 if (onFileAnalyzed != null) {
171 onFileAnalyzed.cancel();
172 onFileAnalyzed = null;
173 }
174 } 180 }
175 return new ExecutionSetSubscriptionsResult().toResponse(request.id);
176 } 181 }
177 182
178 void _fileAnalyzed(ChangeNotice notice) { 183 void _fileAnalyzed(ChangeNotice notice) {
179 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() { 184 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() {
180 Source source = notice.source; 185 Source source = notice.source;
181 String filePath = source.fullName; 186 String filePath = source.fullName;
182 // check files 187 // check files
183 bool isDartFile = notice.resolvedDartUnit != null; 188 bool isDartFile = notice.resolvedDartUnit != null;
184 if (!isDartFile) { 189 if (!isDartFile) {
185 return; 190 return;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (_isInAnalysisRoot(filePath)) { 260 if (_isInAnalysisRoot(filePath)) {
256 server.sendNotification( 261 server.sendNotification(
257 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification()); 262 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification());
258 } 263 }
259 } 264 }
260 265
261 static List<String> _getFullNames(List<Source> sources) { 266 static List<String> _getFullNames(List<Source> sources) {
262 return sources.map((Source source) => source.fullName).toList(); 267 return sources.map((Source source) => source.fullName).toList();
263 } 268 }
264 } 269 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart ('k') | pkg/analysis_server/test/domain_execution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698