OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 part of core; | 5 part of core; |
6 | 6 |
7 class MojoHandle { | 7 class MojoHandle { |
| 8 // TODO(floitsch): get the INVALID value from the backing internal |
| 9 // implementation. |
8 static const int INVALID = 0; | 10 static const int INVALID = 0; |
9 static const int DEADLINE_INDEFINITE = -1; | 11 static const int DEADLINE_INDEFINITE = -1; |
10 | 12 |
11 int _h; | 13 // The type of this field is determined by the backing internal |
12 int get h => _h; | 14 // implementation. |
| 15 Object _h; |
| 16 Object get h => _h; |
13 | 17 |
14 MojoHandle(this._h, {String description}) { | 18 MojoHandle(this._h, {String description}) { |
15 MojoHandleNatives.addOpenHandle(_h, description: description); | 19 MojoHandleNatives.addOpenHandle(_h, description: description); |
16 } | 20 } |
17 | 21 |
18 MojoHandle._internal(this._h); | 22 MojoHandle._internal(this._h); |
19 | 23 |
20 MojoHandle.invalid() : this._internal(INVALID); | 24 MojoHandle.invalid() : this._internal(INVALID); |
21 | 25 |
22 int close() { | 26 int close() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 86 } |
83 | 87 |
84 static bool registerFinalizer(MojoEventSubscription eventSubscription) { | 88 static bool registerFinalizer(MojoEventSubscription eventSubscription) { |
85 return MojoHandleNatives.registerFinalizer( | 89 return MojoHandleNatives.registerFinalizer( |
86 eventSubscription, eventSubscription._handle.h) == | 90 eventSubscription, eventSubscription._handle.h) == |
87 MojoResult.kOk; | 91 MojoResult.kOk; |
88 } | 92 } |
89 | 93 |
90 static bool reportLeakedHandles() => MojoHandleNatives.reportOpenHandles(); | 94 static bool reportLeakedHandles() => MojoHandleNatives.reportOpenHandles(); |
91 } | 95 } |
OLD | NEW |