Index: mojo/public/utility/scoped_handle.h |
diff --git a/mojo/public/utility/scoped_handle.h b/mojo/public/utility/scoped_handle.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e153baaec78cd7d43f6b033f96abb328d602bae5 |
--- /dev/null |
+++ b/mojo/public/utility/scoped_handle.h |
@@ -0,0 +1,27 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MOJO_PUBLIC_UTILITY_SCOPED_HANDLE_H_ |
+#define MOJO_PUBLIC_UTILITY_SCOPED_HANDLE_H_ |
+ |
+#include "mojo/public/system/core.h" |
+ |
+namespace mojo { |
+ |
+// Closes handle_ when deleted. |
+// This probably wants tons of improvements, but those can be made as needed. |
+class ScopedHandle { |
+ public: |
+ ScopedHandle(Handle handle); |
+ ~ScopedHandle(); |
+ Handle get() const { return handle_; } |
+ Handle Release(); |
+ |
+ private: |
+ Handle handle_; |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // MOJO_PUBLIC_SYSTEM_SCOPED_HANDLE_H_ |