Chromium Code Reviews| 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:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| 11 import 'dart:vmservice'; | 11 import 'dart:vmservice'; |
| 12 | 12 |
| 13 part 'resources.dart'; | 13 part 'resources.dart'; |
| 14 part 'server.dart'; | 14 part 'server.dart'; |
| 15 | 15 |
| 16 // The TCP port that the HTTP server listens on. | 16 // The TCP port that the HTTP server listens on. |
| 17 int _port; | 17 int _port; |
| 18 | 18 |
| 19 // HTTP servr. | |
| 20 Server server; | |
| 21 | |
| 19 // The VM service instance. | 22 // The VM service instance. |
| 20 VMService service; | 23 VMService service; |
| 21 | 24 |
| 25 void _onSignal(ProcessSignal signal) { | |
|
Ivan Posva
2014/04/14 16:12:58
_onUSR1Signal or _onVMServiceSignal
Cutch
2014/04/15 17:42:07
Done.
| |
| 26 // Toggle HTTP server. | |
| 27 if (server.running) { | |
| 28 server.shutdown(); | |
| 29 } else { | |
| 30 server.startup(); | |
| 31 } | |
| 32 } | |
| 33 | |
| 22 main() { | 34 main() { |
| 23 // Get VMService. | 35 // Get VMService. |
| 24 service = new VMService(); | 36 service = new VMService(); |
| 37 // Listen for SIGUSR1. | |
| 38 ProcessSignal.SIGUSR1.watch().listen(_onSignal); | |
|
turnidge
2014/04/14 16:51:46
If a signal is processed immediately at this point
Cutch
2014/04/15 17:42:07
dart:io signals aren't delivered like regular sign
| |
| 25 // Start HTTP server. | 39 // Start HTTP server. |
| 26 var server = new Server(service, _port); | 40 server = new Server(service, _port); |
| 27 server.startServer(); | 41 if (_port != 0) { |
| 42 // Port was specified, start HTTP server immediately. | |
| 43 server.startup(); | |
| 44 } | |
| 28 } | 45 } |
| OLD | NEW |