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

Side by Side Diff: pkg/analyzer_plugin/lib/plugin/plugin.dart

Issue 2685613002: Use toList to copy lists and clean up errors and warnings (Closed)
Patch Set: 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
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/result_merger.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'package:analyzer/file_system/file_system.dart'; 5 import 'package:analyzer/file_system/file_system.dart';
6 import 'package:analyzer/src/dart/analysis/byte_store.dart'; 6 import 'package:analyzer/src/dart/analysis/byte_store.dart';
7 import 'package:analyzer/src/dart/analysis/driver.dart' 7 import 'package:analyzer/src/dart/analysis/driver.dart'
8 show AnalysisDriverScheduler, PerformanceLog; 8 show AnalysisDriverScheduler, PerformanceLog;
9 import 'package:analyzer/src/dart/analysis/file_byte_store.dart'; 9 import 'package:analyzer/src/dart/analysis/file_byte_store.dart';
10 import 'package:analyzer/src/dart/analysis/file_state.dart'; 10 import 'package:analyzer/src/dart/analysis/file_state.dart';
11 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
12 import 'package:analyzer_plugin/channel/channel.dart'; 12 import 'package:analyzer_plugin/channel/channel.dart';
13 import 'package:analyzer_plugin/protocol/generated_protocol.dart'; 13 import 'package:analyzer_plugin/protocol/generated_protocol.dart';
14 import 'package:analyzer_plugin/protocol/protocol.dart'; 14 import 'package:analyzer_plugin/protocol/protocol.dart';
15 import 'package:analyzer_plugin/protocol/protocol_constants.dart'; 15 import 'package:analyzer_plugin/protocol/protocol_constants.dart';
16 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; 16 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
17 import 'package:analyzer_plugin/src/utilities/null_string_sink.dart'; 17 import 'package:analyzer_plugin/src/utilities/null_string_sink.dart';
18 import 'package:analyzer_plugin/utilities/subscription_manager.dart'; 18 import 'package:analyzer_plugin/utilities/subscription_manager.dart';
19 import 'package:pub_semver/pub_semver.dart'; 19 import 'package:pub_semver/pub_semver.dart';
20 20
21 /** 21 /**
22 * The abstract superclass of any class implementing a plugin for the analysis 22 * The abstract superclass of any class implementing a plugin for the analysis
23 * server. 23 * server.
24 * 24 *
25 * Clients may not implement or mix-in this class, but are expected to extend 25 * Clients may not implement or mix-in this class, but are expected to extend
26 * it. 26 * it.
27 */ 27 */
28 abstract class ServerPlugin { 28 abstract class ServerPlugin {
29 /** 29 /**
30 * A gigabyte.
31 */
32 static const int G = 1024 * 1024 * 1024;
33
34 /**
35 * A megabyte. 30 * A megabyte.
36 */ 31 */
37 static const int M = 1024 * 1024; 32 static const int M = 1024 * 1024;
38 33
39 /** 34 /**
40 * The communication channel being used to communicate with the analysis 35 * The communication channel being used to communicate with the analysis
41 * server. 36 * server.
42 */ 37 */
43 PluginCommunicationChannel _channel; 38 PluginCommunicationChannel _channel;
44 39
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 * Handle a 'plugin.versionCheck' request. 258 * Handle a 'plugin.versionCheck' request.
264 */ 259 */
265 PluginVersionCheckResult handlePluginVersionCheck( 260 PluginVersionCheckResult handlePluginVersionCheck(
266 Map<String, Object> parameters) { 261 Map<String, Object> parameters) {
267 String byteStorePath = validateParameter(parameters, 262 String byteStorePath = validateParameter(parameters,
268 PLUGIN_REQUEST_VERSION_CHECK_BYTESTOREPATH, 'plugin.versionCheck'); 263 PLUGIN_REQUEST_VERSION_CHECK_BYTESTOREPATH, 'plugin.versionCheck');
269 String versionString = validateParameter(parameters, 264 String versionString = validateParameter(parameters,
270 PLUGIN_REQUEST_VERSION_CHECK_VERSION, 'plugin.versionCheck'); 265 PLUGIN_REQUEST_VERSION_CHECK_VERSION, 'plugin.versionCheck');
271 Version serverVersion = new Version.parse(versionString); 266 Version serverVersion = new Version.parse(versionString);
272 _byteStore = 267 _byteStore =
273 new MemoryCachingByteStore(new FileByteStore(byteStorePath, G), 64 * M); 268 new MemoryCachingByteStore(new FileByteStore(byteStorePath), 64 * M);
274 return new PluginVersionCheckResult( 269 return new PluginVersionCheckResult(
275 isCompatibleWith(serverVersion), name, version, fileGlobsToAnalyze, 270 isCompatibleWith(serverVersion), name, version, fileGlobsToAnalyze,
276 contactInfo: contactInfo); 271 contactInfo: contactInfo);
277 } 272 }
278 273
279 /** 274 /**
280 * Return `true` if this plugin is compatible with an analysis server that is 275 * Return `true` if this plugin is compatible with an analysis server that is
281 * using the given version of the plugin API. 276 * using the given version of the plugin API.
282 */ 277 */
283 bool isCompatibleWith(Version serverVersion) => 278 bool isCompatibleWith(Version serverVersion) =>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 response = new Response(id, 396 response = new Response(id,
402 error: new RequestError( 397 error: new RequestError(
403 RequestErrorCode.PLUGIN_ERROR, exception.toString(), 398 RequestErrorCode.PLUGIN_ERROR, exception.toString(),
404 stackTrace: stackTrace.toString())); 399 stackTrace: stackTrace.toString()));
405 } 400 }
406 if (response != null) { 401 if (response != null) {
407 _channel.sendResponse(response); 402 _channel.sendResponse(response);
408 } 403 }
409 } 404 }
410 } 405 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/result_merger.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698