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

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

Issue 175183008: Analysis server connect fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add comment Created 6 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 | Annotate | Revision Log
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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_logger.dart'; 9 import 'package:analysis_server/src/analysis_logger.dart';
10 import 'package:analysis_server/src/channel.dart'; 10 import 'package:analysis_server/src/channel.dart';
(...skipping 17 matching lines...) Expand all
28 28
29 /** 29 /**
30 * The name of the parameter whose value is a source. 30 * The name of the parameter whose value is a source.
31 */ 31 */
32 static const String SOURCE_PARAM = 'source'; 32 static const String SOURCE_PARAM = 'source';
33 33
34 /** 34 /**
35 * The channel from which requests are received and to which responses should 35 * The channel from which requests are received and to which responses should
36 * be sent. 36 * be sent.
37 */ 37 */
38 CommunicationChannel channel; 38 final CommunicationChannel channel;
39 39
40 /** 40 /**
41 * A flag indicating whether the server is running. 41 * A flag indicating whether the server is running.
42 */ 42 */
43 bool running; 43 bool running;
44 44
45 /** 45 /**
46 * A list of the request handlers used to handle the requests sent to this 46 * A list of the request handlers used to handle the requests sent to this
47 * server. 47 * server.
48 */ 48 */
49 List<RequestHandler> handlers; 49 List<RequestHandler> handlers;
50 50
51 /** 51 /**
52 * A table mapping context id's to the analysis contexts associated with them. 52 * A table mapping context id's to the analysis contexts associated with them.
53 */ 53 */
54 final Map<String, AnalysisContext> contextMap = new Map<String, AnalysisContex t>(); 54 final Map<String, AnalysisContext> contextMap = new Map<String, AnalysisContex t>();
55 55
56 /** 56 /**
57 * A list of the analysis contexts for which analysis work needs to be 57 * A list of the analysis contexts for which analysis work needs to be
58 * performed. 58 * performed.
59 */ 59 */
60 final List<AnalysisContext> contextWorkQueue = new List<AnalysisContext>(); 60 final List<AnalysisContext> contextWorkQueue = new List<AnalysisContext>();
61 61
62 /** 62 /**
63 * Initialize a newly created server to receive requests from and send 63 * Initialize a newly created server to receive requests from and send
64 * responses to the given [channel]. 64 * responses to the given [channel].
65 */ 65 */
66 AnalysisServer(CommunicationChannel channel) { 66 AnalysisServer(this.channel) {
67 AnalysisEngine.instance.logger = new AnalysisLogger(); 67 AnalysisEngine.instance.logger = new AnalysisLogger();
68 running = true; 68 running = true;
69 this.channel = channel; 69 // TODO set running=false on done or error
70 this.channel.listen(handleRequest, onError: error, onDone: done); 70 channel.listen(handleRequest);
71 } 71 }
72 72
73 /** 73 /**
74 * Add the given [context] to the list of analysis contexts for which analysis 74 * Add the given [context] to the list of analysis contexts for which analysis
75 * work needs to be performed. Ensure that the work will be performed. 75 * work needs to be performed. Ensure that the work will be performed.
76 */ 76 */
77 void addContextToWorkQueue(AnalysisContext context) { 77 void addContextToWorkQueue(AnalysisContext context) {
78 if (!contextWorkQueue.contains(context)) { 78 if (!contextWorkQueue.contains(context)) {
79 contextWorkQueue.add(context); 79 contextWorkQueue.add(context);
80 run(); 80 run();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 } 169 }
170 170
171 /** 171 /**
172 * Send the given [notification] to the client. 172 * Send the given [notification] to the client.
173 */ 173 */
174 void sendNotification(Notification notification) { 174 void sendNotification(Notification notification) {
175 channel.sendNotification(notification); 175 channel.sendNotification(notification);
176 } 176 }
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698