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 _hasSignals = true; |
Cutch
2016/07/21 20:24:51
This change is likely to break other embedders who
zra
2016/07/22 17:47:20
Restored _isWindows. Added _isFuchsia.
| |
25 var _signalWatch; | 25 var _signalWatch; |
26 var _signalSubscription; | 26 var _signalSubscription; |
27 | 27 |
28 // HTTP server. | 28 // HTTP server. |
29 Server server; | 29 Server server; |
30 Future<Server> serverFuture; | 30 Future<Server> serverFuture; |
31 | 31 |
32 _lazyServerBoot() { | 32 _lazyServerBoot() { |
33 if (server != null) { | 33 if (server != null) { |
34 return; | 34 return; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 } | 170 } |
171 | 171 |
172 Timer _registerSignalHandlerTimer; | 172 Timer _registerSignalHandlerTimer; |
173 | 173 |
174 _registerSignalHandler() { | 174 _registerSignalHandler() { |
175 _registerSignalHandlerTimer = null; | 175 _registerSignalHandlerTimer = null; |
176 if (_signalWatch == null) { | 176 if (_signalWatch == null) { |
177 // Cannot register for signals. | 177 // Cannot register for signals. |
178 return; | 178 return; |
179 } | 179 } |
180 if (_isWindows) { | 180 if (!_hasSignals) { |
181 // Cannot register for signals on Windows. | 181 // Cannot register for signals on Windows or Fuchsia. |
182 return; | 182 return; |
183 } | 183 } |
184 _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); | 184 _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); |
185 } | 185 } |
186 | 186 |
187 main() { | 187 main() { |
188 // Set embedder hooks. | 188 // Set embedder hooks. |
189 VMServiceEmbedderHooks.cleanup = cleanupCallback; | 189 VMServiceEmbedderHooks.cleanup = cleanupCallback; |
190 VMServiceEmbedderHooks.createTempDir = createTempDirCallback; | 190 VMServiceEmbedderHooks.createTempDir = createTempDirCallback; |
191 VMServiceEmbedderHooks.deleteDir = deleteDirCallback; | 191 VMServiceEmbedderHooks.deleteDir = deleteDirCallback; |
(...skipping 11 matching lines...) Expand all Loading... | |
203 Timer.run(() {}); | 203 Timer.run(() {}); |
204 } | 204 } |
205 scriptLoadPort.handler = _processLoadRequest; | 205 scriptLoadPort.handler = _processLoadRequest; |
206 // Register signal handler after a small delay to avoid stalling main | 206 // Register signal handler after a small delay to avoid stalling main |
207 // isolate startup. | 207 // isolate startup. |
208 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); | 208 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); |
209 return scriptLoadPort; | 209 return scriptLoadPort; |
210 } | 210 } |
211 | 211 |
212 _shutdown() native "VMServiceIO_Shutdown"; | 212 _shutdown() native "VMServiceIO_Shutdown"; |
OLD | NEW |