Chromium Code Reviews| 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..8135a43ffdd567509fcc62efe50a955ed3a201dd |
| --- /dev/null |
| +++ b/mojo/public/utility/scoped_handle.h |
| @@ -0,0 +1,28 @@ |
| +// 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" |
| +#include "mojo/public/system/system_export.h" |
|
darin (slow to review)
2013/11/01 23:05:13
LGTM w/ this line and the MOJO_SYSTEM_EXPORT remov
|
| + |
| +namespace mojo { |
| + |
| +// Closes handle_ when deleted. |
| +// This probably wants tons of improvements, but those can be made as needed. |
| +class MOJO_SYSTEM_EXPORT ScopedHandle { |
|
darin (slow to review)
2013/11/01 23:04:52
nit: no need for the export. this is a static libr
|
| + public: |
| + ScopedHandle(Handle handle); |
| + ~ScopedHandle(); |
| + Handle get() const { return handle_; } |
| + Handle Release(); |
| + |
| + private: |
| + Handle handle_; |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_SYSTEM_SCOPED_HANDLE_H_ |