| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Attaches [callback] as a finalizer for [object]. After [object] has been | 61 * Attaches [callback] as a finalizer for [object]. After [object] has been |
| 62 * garbage collected, [callback] will be called and passed [peer] as an | 62 * garbage collected, [callback] will be called and passed [peer] as an |
| 63 * argument. | 63 * argument. |
| 64 * | 64 * |
| 65 * Neither [callback] nor [peer] should contain any references to [object]; | 65 * Neither [callback] nor [peer] should contain any references to [object]; |
| 66 * otherwise, [object] will never be collected and [callback] will never be | 66 * otherwise, [object] will never be collected and [callback] will never be |
| 67 * called. | 67 * called. |
| 68 */ | 68 */ |
| 69 void attachFinalizer(object, void callback(peer), [peer]) | 69 void attachFinalizer(object, void callback(peer), [peer]) {} |
| 70 native "Archive_AttachFinalizer"; | 70 |
| 71 // TODO(nweiz): re-enable this once issue 4378 is fixed. |
| 72 // void attachFinalizer(object, void callback(peer), [peer]) |
| 73 // native "Archive_AttachFinalizer"; |
| 71 | 74 |
| 72 /** | 75 /** |
| 73 * A reference to a single value. | 76 * A reference to a single value. |
| 74 * | 77 * |
| 75 * This is primarily meant to be used when a finalizer needs to refer to a field | 78 * This is primarily meant to be used when a finalizer needs to refer to a field |
| 76 * on the object being finalized that may be set to null during the lifetime of | 79 * on the object being finalized that may be set to null during the lifetime of |
| 77 * the object. Since the object itself has been garbage collected once the | 80 * the object. Since the object itself has been garbage collected once the |
| 78 * finalizer runs, it needs a second-order reference to check if the field is | 81 * finalizer runs, it needs a second-order reference to check if the field is |
| 79 * null. | 82 * null. |
| 80 */ | 83 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 /** The error code for the error, or null. */ | 103 /** The error code for the error, or null. */ |
| 101 final int errno; | 104 final int errno; |
| 102 | 105 |
| 103 ArchiveException(this.message, [this.errno]); | 106 ArchiveException(this.message, [this.errno]); |
| 104 | 107 |
| 105 String toString() { | 108 String toString() { |
| 106 if (errno == null) return "Archive error: $message"; | 109 if (errno == null) return "Archive error: $message"; |
| 107 return "Archive error $errno: $message"; | 110 return "Archive error $errno: $message"; |
| 108 } | 111 } |
| 109 } | 112 } |
| OLD | NEW |