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..d7be3f3f8d454c9b8d08b6981deb916c8bd79a95 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))), |
+ PassedHandleType_is_not_a_subtype_of_HandleType); |
viettrungluu
2014/04/03 21:19:08
This should be the other way around: HandleType_is
sky
2014/04/03 21:26:45
Done.
|
+ return ScopedHandleBase<HandleType>( |
+ static_cast<HandleType>(other.release().value())); |
+ } |
+ |
void swap(ScopedHandleBase& other) { |
handle_.swap(other.handle_); |
} |