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

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

Issue 756193002: Add --enable-incremental-resolution option. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 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/domain_analysis.dart'; 9 import 'package:analysis_server/src/domain_analysis.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 32
33 /** 33 /**
34 * Instances of the class [SocketServer] implement the common parts of 34 * Instances of the class [SocketServer] implement the common parts of
35 * http-based and stdio-based analysis servers. The primary responsibility of 35 * http-based and stdio-based analysis servers. The primary responsibility of
36 * the SocketServer is to manage the lifetime of the AnalysisServer and to 36 * the SocketServer is to manage the lifetime of the AnalysisServer and to
37 * encode and decode the JSON messages exchanged with the client. 37 * encode and decode the JSON messages exchanged with the client.
38 */ 38 */
39 class SocketServer { 39 class SocketServer {
40 final AnalysisServerOptions analysisServerOptions;
41 final DirectoryBasedDartSdk defaultSdk;
42
40 /** 43 /**
41 * The analysis server that was created when a client established a 44 * The analysis server that was created when a client established a
42 * connection, or `null` if no such connection has yet been established. 45 * connection, or `null` if no such connection has yet been established.
43 */ 46 */
44 AnalysisServer analysisServer; 47 AnalysisServer analysisServer;
45 48
46 final DirectoryBasedDartSdk defaultSdk; 49 SocketServer(this.analysisServerOptions, this.defaultSdk);
47
48 SocketServer(this.defaultSdk);
49 50
50 /** 51 /**
51 * Create an analysis server which will communicate with the client using the 52 * Create an analysis server which will communicate with the client using the
52 * given serverChannel. 53 * given serverChannel.
53 */ 54 */
54 void createAnalysisServer(ServerCommunicationChannel serverChannel) { 55 void createAnalysisServer(ServerCommunicationChannel serverChannel) {
55 if (analysisServer != null) { 56 if (analysisServer != null) {
56 RequestError error = new RequestError( 57 RequestError error = new RequestError(
57 RequestErrorCode.SERVER_ALREADY_STARTED, 58 RequestErrorCode.SERVER_ALREADY_STARTED,
58 "Server already started"); 59 "Server already started");
59 serverChannel.sendResponse(new Response('', error: error)); 60 serverChannel.sendResponse(new Response('', error: error));
60 serverChannel.listen((Request request) { 61 serverChannel.listen((Request request) {
61 serverChannel.sendResponse(new Response(request.id, error: error)); 62 serverChannel.sendResponse(new Response(request.id, error: error));
62 }); 63 });
63 return; 64 return;
64 } 65 }
65 PhysicalResourceProvider resourceProvider = 66 PhysicalResourceProvider resourceProvider =
66 PhysicalResourceProvider.INSTANCE; 67 PhysicalResourceProvider.INSTANCE;
67 analysisServer = new AnalysisServer( 68 analysisServer = new AnalysisServer(
68 serverChannel, 69 serverChannel,
69 resourceProvider, 70 resourceProvider,
70 new PubPackageMapProvider(resourceProvider, defaultSdk), 71 new PubPackageMapProvider(resourceProvider, defaultSdk),
71 _createIndex(), 72 _createIndex(),
73 analysisServerOptions,
72 defaultSdk, 74 defaultSdk,
73 rethrowExceptions: false); 75 rethrowExceptions: false);
74 _initializeHandlers(analysisServer); 76 _initializeHandlers(analysisServer);
75 } 77 }
76 78
77 /** 79 /**
78 * Initialize the handlers to be used by the given [server]. 80 * Initialize the handlers to be used by the given [server].
79 */ 81 */
80 void _initializeHandlers(AnalysisServer server) { 82 void _initializeHandlers(AnalysisServer server) {
81 server.handlers = [ 83 server.handlers = [
82 new ServerDomainHandler(server), 84 new ServerDomainHandler(server),
83 new AnalysisDomainHandler(server), 85 new AnalysisDomainHandler(server),
84 new EditDomainHandler(server), 86 new EditDomainHandler(server),
85 new SearchDomainHandler(server), 87 new SearchDomainHandler(server),
86 new CompletionDomainHandler(server), 88 new CompletionDomainHandler(server),
87 new ExecutionDomainHandler(server),]; 89 new ExecutionDomainHandler(server),];
88 } 90 }
89 } 91 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698