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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/barback/admin_server.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/lib/src/barback/admin_server.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/admin_server.dart b/sdk/lib/_internal/pub_generated/lib/src/barback/admin_server.dart
similarity index 55%
copy from sdk/lib/_internal/pub/lib/src/barback/admin_server.dart
copy to sdk/lib/_internal/pub_generated/lib/src/barback/admin_server.dart
index c6fd86fdd030fdd94766dd92d65a6fd6229c324b..e4312fec06027ea93ba14416f17ee3d14f48520e 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/admin_server.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/barback/admin_server.dart
@@ -1,72 +1,46 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
library pub.barback.admin_server;
-
import 'dart:async';
import 'dart:io';
-
import 'package:http_parser/http_parser.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf_web_socket/shelf_web_socket.dart';
import 'package:stack_trace/stack_trace.dart';
-
import '../io.dart';
import '../log.dart' as log;
import 'asset_environment.dart';
import 'base_server.dart';
import 'web_socket_api.dart';
-
-/// The web admin interface to pub serve.
-// TODO(rnystrom): Currently this just provides access to the Web Socket API.
-// See #16954.
class AdminServer extends BaseServer {
- /// All currently open [WebSocket] connections.
final _webSockets = new Set<CompatibleWebSocket>();
-
shelf.Handler _handler;
-
- /// Creates a new server and binds it to [port] of [host].
- static Future<AdminServer> bind(AssetEnvironment environment,
- String host, int port) {
+ static Future<AdminServer> bind(AssetEnvironment environment, String host,
+ int port) {
return Chain.track(bindServer(host, port)).then((server) {
log.fine('Bound admin server to $host:$port.');
return new AdminServer._(environment, server);
});
}
-
AdminServer._(AssetEnvironment environment, HttpServer server)
: super(environment, server) {
- _handler = new shelf.Cascade()
- .add(webSocketHandler(_handleWebSocket))
- .add(_handleHttp).handler;
+ _handler = new shelf.Cascade().add(
+ webSocketHandler(_handleWebSocket)).add(_handleHttp).handler;
}
-
- /// Closes the server and all Web Socket connections.
Future close() {
var futures = [super.close()];
futures.addAll(_webSockets.map((socket) => socket.close()));
return Future.wait(futures);
}
-
handleRequest(shelf.Request request) => _handler(request);
-
- /// Handles an HTTP request.
_handleHttp(shelf.Request request) {
- // TODO(rnystrom): Actually respond to requests once there is an admin
- // interface. See #16954.
logRequest(request, "501 Not Implemented");
- return new shelf.Response(501,
+ return new shelf.Response(
+ 501,
body: "Currently this server only accepts Web Socket connections.");
}
-
- /// Creates a web socket for [request] which should be an upgrade request.
void _handleWebSocket(CompatibleWebSocket socket) {
_webSockets.add(socket);
var api = new WebSocketApi(socket, environment);
- api.listen()
- .whenComplete(() => _webSockets.remove(api))
- .catchError(addError);
+ api.listen().whenComplete(
+ () => _webSockets.remove(api)).catchError(addError);
}
}

Powered by Google App Engine
This is Rietveld 408576698