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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/build_environment.dart

Issue 184953005: Revamp web socket API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback.dart ('k') | sdk/lib/_internal/pub/lib/src/barback/server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/build_environment.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart
index 47c242d8d00d8feac4120224f7056232fc201f73..012e07c9d2b3c7923f27ad34c6be28a996e06ad2 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart
@@ -58,11 +58,9 @@ class BuildEnvironment {
var barback = new Barback(new PubPackageProvider(graph));
barback.log.listen(_log);
- return _startServers(hostname, basePort, mode, graph, barback,
- rootDirectories).then((servers) {
- var environment = new BuildEnvironment._(graph, servers, mode,
- watcherType, rootDirectories);
-
+ var environment = new BuildEnvironment._(graph, barback, mode,
+ watcherType, rootDirectories);
+ return environment._startServers(hostname, basePort).then((_) {
// If the entrypoint package manually configures the dart2js
// transformer, don't include it in the built-in transformer list.
//
@@ -85,16 +83,13 @@ class BuildEnvironment {
}
/// Start the [BarbackServer]s that will serve [rootDirectories].
- static Future<List<BarbackServer>> _startServers(String hostname,
- int basePort, BarbackMode mode, PackageGraph graph, Barback barback,
- Iterable<String> rootDirectories) {
+ Future<List<BarbackServer>> _startServers(String hostname, int basePort) {
_bind(port, rootDirectory) {
if (basePort == 0) port = 0;
- return BarbackServer.bind(hostname, port, barback,
- graph.entrypoint.root.name, rootDirectory);
+ return BarbackServer.bind(this, hostname, port, rootDirectory);
}
- var rootDirectoryList = rootDirectories.toList();
+ var rootDirectoryList = _rootDirectories.toList();
// For consistency, "web/" should always have the first available port and
// "test/" should always have the second. Other directories are assigned
@@ -113,14 +108,16 @@ class BuildEnvironment {
i += 1;
}
- return Future.wait(serverFutures);
+ return Future.wait(serverFutures).then((boundServers) {
+ servers.addAll(boundServers);
+ });
}
/// The servers serving this environment's assets.
- final List<BarbackServer> servers;
+ final servers = <BarbackServer>[];
/// The [Barback] instance used to process assets in this environment.
- Barback get barback => servers.first.barback;
+ final Barback barback;
/// The root package being built.
Package get rootPackage => graph.entrypoint.root;
@@ -142,7 +139,7 @@ class BuildEnvironment {
/// exposed.
final Set<String> _rootDirectories;
- BuildEnvironment._(this.graph, this.servers, this.mode, this._watcherType,
+ BuildEnvironment._(this.graph, this.barback, this.mode, this._watcherType,
Iterable<String> rootDirectories)
: _rootDirectories = rootDirectories.toSet();
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback.dart ('k') | sdk/lib/_internal/pub/lib/src/barback/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698