| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PUBLIC_SYSTEM_CORE_CPP_H_ | 5 #ifndef MOJO_PUBLIC_SYSTEM_CORE_CPP_H_ |
| 6 #define MOJO_PUBLIC_SYSTEM_CORE_CPP_H_ | 6 #define MOJO_PUBLIC_SYSTEM_CORE_CPP_H_ |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ScopedHandleBase() {} | 27 ScopedHandleBase() {} |
| 28 ~ScopedHandleBase() { CloseIfNecessary(); } | 28 ~ScopedHandleBase() { CloseIfNecessary(); } |
| 29 | 29 |
| 30 // Move-only constructor and operator=. | 30 // Move-only constructor and operator=. |
| 31 ScopedHandleBase(RValue other) : handle_(other.object->release()) {} | 31 ScopedHandleBase(RValue other) : handle_(other.object->release()) {} |
| 32 ScopedHandleBase& operator=(RValue other) { | 32 ScopedHandleBase& operator=(RValue other) { |
| 33 handle_ = other.object->release(); | 33 handle_ = other.object->release(); |
| 34 return *this; | 34 return *this; |
| 35 } | 35 } |
| 36 | 36 |
| 37 operator HandleType() const { return handle_; } | |
| 38 const HandleType& get() const { return handle_; } | 37 const HandleType& get() const { return handle_; } |
| 39 | 38 |
| 40 void swap(ScopedHandleBase& other) { | 39 void swap(ScopedHandleBase& other) { |
| 41 handle_.swap(other.handle_); | 40 handle_.swap(other.handle_); |
| 42 } | 41 } |
| 43 | 42 |
| 44 HandleType release() MOJO_WARN_UNUSED_RESULT { | 43 HandleType release() MOJO_WARN_UNUSED_RESULT { |
| 45 HandleType rv; | 44 HandleType rv; |
| 46 rv.swap(handle_); | 45 rv.swap(handle_); |
| 47 return rv; | 46 return rv; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 MojoReadMessageFlags flags) { | 207 MojoReadMessageFlags flags) { |
| 209 return MojoReadMessage(message_pipe.value(), | 208 return MojoReadMessage(message_pipe.value(), |
| 210 bytes, num_bytes, | 209 bytes, num_bytes, |
| 211 handles, num_handles, | 210 handles, num_handles, |
| 212 flags); | 211 flags); |
| 213 } | 212 } |
| 214 | 213 |
| 215 } // namespace mojo | 214 } // namespace mojo |
| 216 | 215 |
| 217 #endif // MOJO_PUBLIC_SYSTEM_CORE_CPP_H_ | 216 #endif // MOJO_PUBLIC_SYSTEM_CORE_CPP_H_ |
| OLD | NEW |