OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 vmservice_io; | 5 library vmservice_io; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
11 import 'dart:isolate'; | 11 import 'dart:isolate'; |
12 import 'dart:_vmservice'; | 12 import 'dart:_vmservice'; |
13 | 13 |
14 part 'loader.dart'; | 14 part 'loader.dart'; |
15 part 'server.dart'; | 15 part 'server.dart'; |
16 | 16 |
17 // The TCP ip/port that the HTTP server listens on. | 17 // The TCP ip/port that the HTTP server listens on. |
18 int _port; | 18 int _port; |
19 String _ip; | 19 String _ip; |
20 // Should the HTTP server auto start? | 20 // Should the HTTP server auto start? |
21 bool _autoStart; | 21 bool _autoStart; |
22 // Should the HTTP server run in devmode? | 22 // Should the HTTP server run in devmode? |
23 bool _originCheckDisabled; | 23 bool _originCheckDisabled; |
24 bool _isWindows = false; | 24 bool _isWindows = false; |
| 25 bool _isFuchsia = false; |
25 var _signalWatch; | 26 var _signalWatch; |
26 var _signalSubscription; | 27 var _signalSubscription; |
27 | 28 |
28 // HTTP server. | 29 // HTTP server. |
29 Server server; | 30 Server server; |
30 Future<Server> serverFuture; | 31 Future<Server> serverFuture; |
31 | 32 |
32 _lazyServerBoot() { | 33 _lazyServerBoot() { |
33 if (server != null) { | 34 if (server != null) { |
34 return; | 35 return; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 Timer _registerSignalHandlerTimer; | 173 Timer _registerSignalHandlerTimer; |
173 | 174 |
174 _registerSignalHandler() { | 175 _registerSignalHandler() { |
175 _registerSignalHandlerTimer = null; | 176 _registerSignalHandlerTimer = null; |
176 if (_signalWatch == null) { | 177 if (_signalWatch == null) { |
177 // Cannot register for signals. | 178 // Cannot register for signals. |
178 return; | 179 return; |
179 } | 180 } |
180 if (_isWindows) { | 181 if (_isWindows || _isFuchsia) { |
181 // Cannot register for signals on Windows. | 182 // Cannot register for signals on Windows or Fuchsia. |
182 return; | 183 return; |
183 } | 184 } |
184 _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); | 185 _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); |
185 } | 186 } |
186 | 187 |
187 main() { | 188 main() { |
188 // Set embedder hooks. | 189 // Set embedder hooks. |
189 VMServiceEmbedderHooks.cleanup = cleanupCallback; | 190 VMServiceEmbedderHooks.cleanup = cleanupCallback; |
190 VMServiceEmbedderHooks.createTempDir = createTempDirCallback; | 191 VMServiceEmbedderHooks.createTempDir = createTempDirCallback; |
191 VMServiceEmbedderHooks.deleteDir = deleteDirCallback; | 192 VMServiceEmbedderHooks.deleteDir = deleteDirCallback; |
(...skipping 11 matching lines...) Expand all Loading... |
203 Timer.run(() {}); | 204 Timer.run(() {}); |
204 } | 205 } |
205 scriptLoadPort.handler = _processLoadRequest; | 206 scriptLoadPort.handler = _processLoadRequest; |
206 // Register signal handler after a small delay to avoid stalling main | 207 // Register signal handler after a small delay to avoid stalling main |
207 // isolate startup. | 208 // isolate startup. |
208 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); | 209 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); |
209 return scriptLoadPort; | 210 return scriptLoadPort; |
210 } | 211 } |
211 | 212 |
212 _shutdown() native "VMServiceIO_Shutdown"; | 213 _shutdown() native "VMServiceIO_Shutdown"; |
OLD | NEW |