| 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'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (_registerSignalHandlerTimer != null) { | 58 if (_registerSignalHandlerTimer != null) { |
| 59 _registerSignalHandlerTimer.cancel(); | 59 _registerSignalHandlerTimer.cancel(); |
| 60 _registerSignalHandlerTimer = null; | 60 _registerSignalHandlerTimer = null; |
| 61 } | 61 } |
| 62 // Call out to embedder's shutdown callback. | 62 // Call out to embedder's shutdown callback. |
| 63 _shutdown(); | 63 _shutdown(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 Future<Uri> createTempDirCallback(String base) async { | 66 Future<Uri> createTempDirCallback(String base) async { |
| 67 Directory temp = await Directory.systemTemp.createTemp(base); | 67 Directory temp = await Directory.systemTemp.createTemp(base); |
| 68 return temp.uri; | 68 // Underneath the temporary directory, create a directory with the |
| 69 // same name as the DevFS name [base]. |
| 70 var fsUri = temp.uri.resolveUri(new Uri.directory(base)); |
| 71 await new Directory.fromUri(fsUri).create(); |
| 72 return fsUri; |
| 69 } | 73 } |
| 70 | 74 |
| 71 Future deleteDirCallback(Uri path) async { | 75 Future deleteDirCallback(Uri path) async { |
| 72 Directory dir = new Directory.fromUri(path); | 76 Directory dir = new Directory.fromUri(path); |
| 73 await dir.delete(recursive: true); | 77 await dir.delete(recursive: true); |
| 74 } | 78 } |
| 75 | 79 |
| 76 class PendingWrite { | 80 class PendingWrite { |
| 77 PendingWrite(this.uri, this.bytes); | 81 PendingWrite(this.uri, this.bytes); |
| 78 final Completer completer = new Completer(); | 82 final Completer completer = new Completer(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 Timer.run(() {}); | 242 Timer.run(() {}); |
| 239 } | 243 } |
| 240 scriptLoadPort.handler = _processLoadRequest; | 244 scriptLoadPort.handler = _processLoadRequest; |
| 241 // Register signal handler after a small delay to avoid stalling main | 245 // Register signal handler after a small delay to avoid stalling main |
| 242 // isolate startup. | 246 // isolate startup. |
| 243 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); | 247 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); |
| 244 return scriptLoadPort; | 248 return scriptLoadPort; |
| 245 } | 249 } |
| 246 | 250 |
| 247 _shutdown() native "VMServiceIO_Shutdown"; | 251 _shutdown() native "VMServiceIO_Shutdown"; |
| OLD | NEW |