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

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

Issue 872633002: Use 'print' to send responses/notifications to the client. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 stdio.server; 5 library stdio.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io';
9 8
10 import 'package:analysis_server/src/channel/byte_stream_channel.dart'; 9 import 'package:analysis_server/src/channel/byte_stream_channel.dart';
11 import 'package:analysis_server/src/socket_server.dart'; 10 import 'package:analysis_server/src/socket_server.dart';
12 11
13 /** 12 /**
14 * Instances of the class [StdioServer] implement a simple server operating 13 * Instances of the class [StdioServer] implement a simple server operating
15 * over standard input and output. The primary responsibility of this server 14 * over standard input and output. The primary responsibility of this server
16 * is to split incoming messages on newlines and pass them along to the 15 * is to split incoming messages on newlines and pass them along to the
17 * analysis server. 16 * analysis server.
18 */ 17 */
19 class StdioAnalysisServer { 18 class StdioAnalysisServer {
20 /** 19 /**
21 * An object that can handle either a WebSocket connection or a connection 20 * An object that can handle either a WebSocket connection or a connection
22 * to the client over stdio. 21 * to the client over stdio.
23 */ 22 */
24 SocketServer socketServer; 23 SocketServer socketServer;
25 24
26 /** 25 /**
27 * Initialize a newly created stdio server. 26 * Initialize a newly created stdio server.
28 */ 27 */
29 StdioAnalysisServer(this.socketServer); 28 StdioAnalysisServer(this.socketServer);
30 29
31 /** 30 /**
32 * Begin serving requests over stdio. 31 * Begin serving requests over stdio.
33 * 32 *
34 * Return a future that will be completed when stdin closes. 33 * Return a future that will be completed when stdin closes.
35 */ 34 */
36 Future serveStdio() { 35 Future serveStdio() {
37 ByteStreamServerChannel serverChannel = new ByteStreamServerChannel( 36 PrintServerChannel serverChannel =
38 stdin, 37 new PrintServerChannel(socketServer.instrumentationService);
39 stdout.nonBlocking,
40 socketServer.instrumentationService);
41 socketServer.createAnalysisServer(serverChannel); 38 socketServer.createAnalysisServer(serverChannel);
42 return serverChannel.closed; 39 return serverChannel.closed;
43 } 40 }
44 } 41 }
OLDNEW
« pkg/analysis_server/lib/src/protocol.dart ('K') | « pkg/analysis_server/lib/src/protocol.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698