Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Unified Diff: mojo/public/system/core.h

Issue 56553002: Say "noto" goto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/shell/app_container.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/system/core.h
diff --git a/mojo/public/system/core.h b/mojo/public/system/core.h
index 88f2af5c9423a87672f80df577fd449be83bc472..c19ae734b315ffe067a82115195783398fa50bac 100644
--- a/mojo/public/system/core.h
+++ b/mojo/public/system/core.h
@@ -310,6 +310,31 @@ inline MojoResult ReadMessage(Handle handle,
flags);
}
+// Closes handle_ when deleted.
darin (slow to review) 2013/11/01 21:48:52 nit: how about breaking this out into its own head
+// This probably wants tons of improvements, but those can be made as needed.
+class ScopedHandle {
+ public:
+ ScopedHandle(Handle handle) : handle_(handle) {
+ }
+
+ ~ScopedHandle() {
+ if (handle_.value == kInvalidHandle.value)
+ return;
+ Close(handle_);
+ release();
+ }
+
+ Handle get() const { return handle_; }
+ Handle release() {
+ Handle temp = handle_;
+ handle_ = kInvalidHandle;
+ return temp;
+ }
+
+ private:
+ Handle handle_;
+};
+
} // namespace mojo
#endif
« no previous file with comments | « no previous file | mojo/shell/app_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698