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

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

Issue 1020813002: Add plugin info to the status page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/server/driver.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) 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 socket.server; 5 library socket.server;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/channel/channel.dart'; 8 import 'package:analysis_server/src/channel/channel.dart';
9 import 'package:analysis_server/src/plugin/server_plugin.dart'; 9 import 'package:analysis_server/src/plugin/server_plugin.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
11 import 'package:analysis_server/src/services/index/index.dart'; 11 import 'package:analysis_server/src/services/index/index.dart';
12 import 'package:analysis_server/src/services/index/local_file_index.dart'; 12 import 'package:analysis_server/src/services/index/local_file_index.dart';
13 import 'package:analyzer/file_system/physical_file_system.dart'; 13 import 'package:analyzer/file_system/physical_file_system.dart';
14 import 'package:analyzer/instrumentation/instrumentation.dart'; 14 import 'package:analyzer/instrumentation/instrumentation.dart';
15 import 'package:analyzer/plugin/plugin.dart';
15 import 'package:analyzer/source/pub_package_map_provider.dart'; 16 import 'package:analyzer/source/pub_package_map_provider.dart';
16 import 'package:analyzer/src/generated/sdk_io.dart'; 17 import 'package:analyzer/src/generated/sdk_io.dart';
17 18
18 /** 19 /**
19 * Instances of the class [SocketServer] implement the common parts of 20 * Instances of the class [SocketServer] implement the common parts of
20 * http-based and stdio-based analysis servers. The primary responsibility of 21 * http-based and stdio-based analysis servers. The primary responsibility of
21 * the SocketServer is to manage the lifetime of the AnalysisServer and to 22 * the SocketServer is to manage the lifetime of the AnalysisServer and to
22 * encode and decode the JSON messages exchanged with the client. 23 * encode and decode the JSON messages exchanged with the client.
23 */ 24 */
24 class SocketServer { 25 class SocketServer {
25 final AnalysisServerOptions analysisServerOptions; 26 final AnalysisServerOptions analysisServerOptions;
26 final DirectoryBasedDartSdk defaultSdk; 27 final DirectoryBasedDartSdk defaultSdk;
27 final InstrumentationService instrumentationService; 28 final InstrumentationService instrumentationService;
28 final ServerPlugin serverPlugin; 29 final ServerPlugin serverPlugin;
29 30
30 /** 31 /**
31 * The analysis server that was created when a client established a 32 * The analysis server that was created when a client established a
32 * connection, or `null` if no such connection has yet been established. 33 * connection, or `null` if no such connection has yet been established.
33 */ 34 */
34 AnalysisServer analysisServer; 35 AnalysisServer analysisServer;
35 36
37 /**
38 * The plugins that are defined outside the analysis_server package.
39 */
40 List<Plugin> userDefinedPlugins;
41
36 SocketServer(this.analysisServerOptions, this.defaultSdk, 42 SocketServer(this.analysisServerOptions, this.defaultSdk,
37 this.instrumentationService, this.serverPlugin); 43 this.instrumentationService, this.serverPlugin);
38 44
39 /** 45 /**
40 * Create an analysis server which will communicate with the client using the 46 * Create an analysis server which will communicate with the client using the
41 * given serverChannel. 47 * given serverChannel.
42 */ 48 */
43 void createAnalysisServer(ServerCommunicationChannel serverChannel) { 49 void createAnalysisServer(ServerCommunicationChannel serverChannel) {
44 if (analysisServer != null) { 50 if (analysisServer != null) {
45 RequestError error = new RequestError( 51 RequestError error = new RequestError(
(...skipping 20 matching lines...) Expand all
66 if (!analysisServerOptions.noIndex) { 72 if (!analysisServerOptions.noIndex) {
67 index = createLocalFileIndex(); 73 index = createLocalFileIndex();
68 index.run(); 74 index.run();
69 } 75 }
70 76
71 analysisServer = new AnalysisServer(serverChannel, resourceProvider, 77 analysisServer = new AnalysisServer(serverChannel, resourceProvider,
72 new PubPackageMapProvider(resourceProvider, defaultSdk), index, 78 new PubPackageMapProvider(resourceProvider, defaultSdk), index,
73 analysisServerOptions, defaultSdk, instrumentationService, 79 analysisServerOptions, defaultSdk, instrumentationService,
74 rethrowExceptions: false); 80 rethrowExceptions: false);
75 _initializeHandlers(analysisServer); 81 _initializeHandlers(analysisServer);
82 analysisServer.userDefinedPlugins = userDefinedPlugins;
76 } 83 }
77 84
78 /** 85 /**
79 * Initialize the handlers to be used by the given [server]. 86 * Initialize the handlers to be used by the given [server].
80 */ 87 */
81 void _initializeHandlers(AnalysisServer server) { 88 void _initializeHandlers(AnalysisServer server) {
82 server.handlers = serverPlugin.createDomains(server); 89 server.handlers = serverPlugin.createDomains(server);
83 } 90 }
84 } 91 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/server/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698