Chromium Code Reviews| Index: mojo/public/cpp/system/core.h |
| diff --git a/mojo/public/cpp/system/core.h b/mojo/public/cpp/system/core.h |
| index 70221107ab0a2d6ee332d461294840c34c601d55..fc65ea5cc6fe386c13aa4d8ba510654423d222ab 100644 |
| --- a/mojo/public/cpp/system/core.h |
| +++ b/mojo/public/cpp/system/core.h |
| @@ -49,6 +49,16 @@ class ScopedHandleBase { |
| const HandleType& get() const { return handle_; } |
| + template <typename PassedHandleType> |
| + static ScopedHandleBase<HandleType> From( |
| + ScopedHandleBase<PassedHandleType> other) { |
| + MOJO_COMPILE_ASSERT( |
| + sizeof(static_cast<PassedHandleType*>(static_cast<HandleType*>(0))), |
| + HandleType_is_not_a_subtype_of_PassedHandleType); |
| + return ScopedHandleBase<HandleType>( |
| + static_cast<HandleType>(other.release().value())); |
|
darin (slow to review)
2014/04/04 22:40:49
Are you sure about the .value() call here? Doesn't
darin (slow to review)
2014/04/04 22:56:14
Nevermind. I somehow missed the compile assert :-P
|
| + } |
| + |
| void swap(ScopedHandleBase& other) { |
| handle_.swap(other.handle_); |
| } |