OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_EDK_SYSTEM_HANDLE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_H_ |
6 #define MOJO_EDK_SYSTEM_HANDLE_H_ | 6 #define MOJO_EDK_SYSTEM_HANDLE_H_ |
7 | 7 |
8 #include "mojo/edk/util/ref_ptr.h" | 8 #include "mojo/edk/util/ref_ptr.h" |
9 #include "mojo/public/c/system/handle.h" | 9 #include "mojo/public/c/system/handle.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 Handle(util::RefPtr<Dispatcher>&& dispatcher, MojoHandleRights rights); | 26 Handle(util::RefPtr<Dispatcher>&& dispatcher, MojoHandleRights rights); |
27 | 27 |
28 ~Handle(); | 28 ~Handle(); |
29 | 29 |
30 Handle& operator=(const Handle&); | 30 Handle& operator=(const Handle&); |
31 Handle& operator=(Handle&&); | 31 Handle& operator=(Handle&&); |
32 | 32 |
33 // A |Handle| tests as true if it actually has a dispatcher. | 33 // A |Handle| tests as true if it actually has a dispatcher. |
34 explicit operator bool() const { return !!dispatcher; } | 34 explicit operator bool() const { return !!dispatcher; } |
35 | 35 |
| 36 void reset() { *this = Handle(); } |
| 37 |
36 // Note: |dispatcher| is guaranteed to be null if default-constructed or | 38 // Note: |dispatcher| is guaranteed to be null if default-constructed or |
37 // moved-from, but we make no guarantees about the value of |rights| in either | 39 // moved-from, but we make no guarantees about the value of |rights| in either |
38 // case. | 40 // case. |
39 util::RefPtr<Dispatcher> dispatcher; | 41 util::RefPtr<Dispatcher> dispatcher; |
40 MojoHandleRights rights; | 42 MojoHandleRights rights; |
41 }; | 43 }; |
42 | 44 |
43 } // namespace system | 45 } // namespace system |
44 } // namespace mojo | 46 } // namespace mojo |
45 | 47 |
46 #endif // MOJO_EDK_SYSTEM_HANDLE_H_ | 48 #endif // MOJO_EDK_SYSTEM_HANDLE_H_ |
OLD | NEW |