OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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("utils"); | 5 #library("utils"); |
6 | 6 |
7 #import("dart-ext:dart_archive"); | 7 #import("dart-ext:dart_archive"); |
8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
9 #import("archive.dart", prefix: "archive"); | 9 #import("archive.dart", prefix: "archive"); |
10 | 10 |
11 /** The cache of the port used to communicate with the C extension. */ | 11 /** The cache of the port used to communicate with the C extension. */ |
12 SendPort _port; | 12 SendPort _port; |
13 | 13 |
14 /** The port used to communicate with the C extension. */ | 14 /** The port used to communicate with the C extension. */ |
15 SendPort get servicePort() { | 15 SendPort get servicePort { |
16 if (_port == null) _port = _newServicePort(); | 16 if (_port == null) _port = _newServicePort(); |
17 return _port; | 17 return _port; |
18 } | 18 } |
19 | 19 |
20 /** Creates a new port to communicate with the C extension. */ | 20 /** Creates a new port to communicate with the C extension. */ |
21 SendPort _newServicePort() native "Archive_ServicePort"; | 21 SendPort _newServicePort() native "Archive_ServicePort"; |
22 | 22 |
23 /** | 23 /** |
24 * Send a message to the C extension. | 24 * Send a message to the C extension. |
25 * | 25 * |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 /** The error code for the error, or null. */ | 103 /** The error code for the error, or null. */ |
104 final int errno; | 104 final int errno; |
105 | 105 |
106 ArchiveException(this.message, [this.errno]); | 106 ArchiveException(this.message, [this.errno]); |
107 | 107 |
108 String toString() { | 108 String toString() { |
109 if (errno == null) return "Archive error: $message"; | 109 if (errno == null) return "Archive error: $message"; |
110 return "Archive error $errno: $message"; | 110 return "Archive error $errno: $message"; |
111 } | 111 } |
112 } | 112 } |
OLD | NEW |