Chromium Code Reviews| Index: pkg/analysis_server/lib/http_server.dart |
| diff --git a/pkg/analysis_server/lib/http_server.dart b/pkg/analysis_server/lib/http_server.dart |
| index 1fbd0afcc4ed25f1b8488efd2636c720a4ad78b7..a56cd507166cc326f04c8a603b29fa8dee89ca56 100644 |
| --- a/pkg/analysis_server/lib/http_server.dart |
| +++ b/pkg/analysis_server/lib/http_server.dart |
| @@ -18,6 +18,11 @@ import 'package:analysis_server/src/socket_server.dart'; |
| */ |
| class HttpAnalysisServer { |
| /** |
| + * Number of lines of print output to capture. |
| + */ |
| + static const int PRINT_BUFFER_LENGTH = 1000; |
|
danrubel
2014/10/28 21:01:02
MAX_PRINT_BUFFER_MAX_LENGTH ?
Paul Berry
2014/10/28 23:29:13
Done.
|
| + |
| + /** |
| * An object that can handle either a WebSocket connection or a connection |
| * to the client over stdio. |
| */ |
| @@ -39,6 +44,11 @@ class HttpAnalysisServer { |
| Future<HttpServer> _server; |
| /** |
| + * Last PRINT_BUFFER_LENGTH lines printed. |
| + */ |
| + List<String> _printBuffer = <String>[]; |
| + |
| + /** |
| * Attach a listener to a newly created HTTP server. |
| */ |
| void _handleServer(HttpServer httServer) { |
| @@ -61,7 +71,7 @@ class HttpAnalysisServer { |
| */ |
| void _handleGetRequest(HttpRequest request) { |
| if (getHandler == null) { |
| - getHandler = new GetHandler(socketServer); |
| + getHandler = new GetHandler(socketServer, _printBuffer); |
| } |
| getHandler.handleGetRequest(request); |
| } |
| @@ -99,4 +109,14 @@ class HttpAnalysisServer { |
| server.close(); |
| }); |
| } |
| + |
| + /** |
| + * Record that the given line was printed out by the analysis server. |
| + */ |
| + void recordPrint(String line) { |
| + _printBuffer.add(line); |
| + if (_printBuffer.length > PRINT_BUFFER_LENGTH) { |
| + _printBuffer.removeRange(0, _printBuffer.length - PRINT_BUFFER_LENGTH); |
| + } |
| + } |
| } |