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

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

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: update from review comments Created 3 years, 5 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:core'; 6 import 'dart:core';
7 7
8 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; 8 import 'package:analysis_server/plugin/analysis/analysis_domain.dart';
9 import 'package:analysis_server/protocol/protocol_constants.dart'; 9 import 'package:analysis_server/protocol/protocol_constants.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } on RequestFailure catch (exception) { 241 } on RequestFailure catch (exception) {
242 return exception.response; 242 return exception.response;
243 } 243 }
244 return null; 244 return null;
245 } 245 }
246 246
247 /** 247 /**
248 * Implement the 'analysis.reanalyze' request. 248 * Implement the 'analysis.reanalyze' request.
249 */ 249 */
250 Response reanalyze(Request request) { 250 Response reanalyze(Request request) {
251 server.options.analytics?.sendEvent('analysis', 'reanalyze');
252
251 AnalysisReanalyzeParams params = 253 AnalysisReanalyzeParams params =
252 new AnalysisReanalyzeParams.fromRequest(request); 254 new AnalysisReanalyzeParams.fromRequest(request);
253 List<String> roots = params.roots; 255 List<String> roots = params.roots;
254 if (roots == null || roots.isNotEmpty) { 256 if (roots == null || roots.isNotEmpty) {
255 List<String> includedPaths = server.contextManager.includedPaths; 257 List<String> includedPaths = server.contextManager.includedPaths;
256 List<Resource> rootResources = null; 258 List<Resource> rootResources = null;
257 if (roots != null) { 259 if (roots != null) {
258 rootResources = <Resource>[]; 260 rootResources = <Resource>[];
259 for (String rootPath in roots) { 261 for (String rootPath in roots) {
260 if (!includedPaths.contains(rootPath)) { 262 if (!includedPaths.contains(rootPath)) {
(...skipping 16 matching lines...) Expand all
277 return new AnalysisReanalyzeResult().toResponse(request.id); 279 return new AnalysisReanalyzeResult().toResponse(request.id);
278 } 280 }
279 281
280 /** 282 /**
281 * Implement the 'analysis.setAnalysisRoots' request. 283 * Implement the 'analysis.setAnalysisRoots' request.
282 */ 284 */
283 Response setAnalysisRoots(Request request) { 285 Response setAnalysisRoots(Request request) {
284 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request); 286 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request);
285 List<String> includedPathList = params.included; 287 List<String> includedPathList = params.included;
286 List<String> excludedPathList = params.excluded; 288 List<String> excludedPathList = params.excluded;
289
290 server.options.analytics?.sendEvent('analysis', 'setAnalysisRoots',
291 value: includedPathList.length);
292
287 // validate 293 // validate
288 for (String path in includedPathList) { 294 for (String path in includedPathList) {
289 if (!server.isValidFilePath(path)) { 295 if (!server.isValidFilePath(path)) {
290 return new Response.invalidFilePathFormat(request, path); 296 return new Response.invalidFilePathFormat(request, path);
291 } 297 }
292 } 298 }
293 for (String path in excludedPathList) { 299 for (String path in excludedPathList) {
294 if (!server.isValidFilePath(path)) { 300 if (!server.isValidFilePath(path)) {
295 return new Response.invalidFilePathFormat(request, path); 301 return new Response.invalidFilePathFormat(request, path);
296 } 302 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 436
431 AnalysisDomainImpl(this.server) { 437 AnalysisDomainImpl(this.server) {
432 // TODO(brianwilkerson) The onContextsChanged stream is no longer written to . 438 // TODO(brianwilkerson) The onContextsChanged stream is no longer written to .
433 // Figure out whether this code still needs to be here and convert it to use 439 // Figure out whether this code still needs to be here and convert it to use
434 // the analysis driver if it does. 440 // the analysis driver if it does.
435 // server.onContextsChanged.listen((ContextsChangedEvent event) { 441 // server.onContextsChanged.listen((ContextsChangedEvent event) {
436 // event.added.forEach(_subscribeForContext); 442 // event.added.forEach(_subscribeForContext);
437 // }); 443 // });
438 } 444 }
439 } 445 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/domain_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698