OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:async/async.dart'; | 9 import 'package:async/async.dart'; |
10 import 'package:http_multi_server/http_multi_server.dart'; | 10 import 'package:http_multi_server/http_multi_server.dart'; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 final _compileFutures = new Map<String, Future>(); | 107 final _compileFutures = new Map<String, Future>(); |
108 | 108 |
109 /// Mappers for Dartifying stack traces, indexed by test path. | 109 /// Mappers for Dartifying stack traces, indexed by test path. |
110 final _mappers = new Map<String, StackTraceMapper>(); | 110 final _mappers = new Map<String, StackTraceMapper>(); |
111 | 111 |
112 BrowserPlatform._(this._server, Configuration config, {String root}) | 112 BrowserPlatform._(this._server, Configuration config, {String root}) |
113 : _root = root == null ? p.current : root, | 113 : _root = root == null ? p.current : root, |
114 _config = config, | 114 _config = config, |
115 _compiledDir = config.pubServeUrl == null ? createTempDir() : null, | 115 _compiledDir = config.pubServeUrl == null ? createTempDir() : null, |
116 _http = config.pubServeUrl == null ? null : new HttpClient(), | 116 _http = config.pubServeUrl == null ? null : new HttpClient(), |
117 _compilers = new CompilerPool(color: config.color) { | 117 _compilers = new CompilerPool(config) { |
118 var cascade = new shelf.Cascade() | 118 var cascade = new shelf.Cascade() |
119 .add(_webSocketHandler.handler); | 119 .add(_webSocketHandler.handler); |
120 | 120 |
121 if (_config.pubServeUrl == null) { | 121 if (_config.pubServeUrl == null) { |
122 cascade = cascade | 122 cascade = cascade |
123 .add(_createPackagesHandler()) | 123 .add(_createPackagesHandler()) |
124 .add(_jsHandler.handler) | 124 .add(_jsHandler.handler) |
125 .add(createStaticHandler(_root)) | 125 .add(createStaticHandler(_root)) |
126 .add(_wrapperHandler); | 126 .add(_wrapperHandler); |
127 } | 127 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 await Future.wait(futures); | 423 await Future.wait(futures); |
424 | 424 |
425 if (_config.pubServeUrl == null) { | 425 if (_config.pubServeUrl == null) { |
426 new Directory(_compiledDir).deleteSync(recursive: true); | 426 new Directory(_compiledDir).deleteSync(recursive: true); |
427 } else { | 427 } else { |
428 _http.close(); | 428 _http.close(); |
429 } | 429 } |
430 }); | 430 }); |
431 final _closeMemo = new AsyncMemoizer(); | 431 final _closeMemo = new AsyncMemoizer(); |
432 } | 432 } |
OLD | NEW |