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

Unified Diff: mojo/public/utility/scoped_handle.cc

Issue 56553002: Say "noto" goto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: eru? 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 | « mojo/public/utility/scoped_handle.h ('k') | 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/utility/scoped_handle.cc
diff --git a/mojo/public/utility/scoped_handle.cc b/mojo/public/utility/scoped_handle.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cba4b8aadbbb5715699e4ab15ea798fd8e58c50e
--- /dev/null
+++ b/mojo/public/utility/scoped_handle.cc
@@ -0,0 +1,25 @@
+// 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.
+
+#include "mojo/public/utility/scoped_handle.h"
+
+namespace mojo {
+
+ScopedHandle::ScopedHandle(Handle handle) : handle_(handle) {
+}
+
+ScopedHandle::~ScopedHandle() {
+ if (handle_.value == kInvalidHandle.value)
+ return;
+ Close(handle_);
+ Release();
+}
+
+Handle ScopedHandle::Release() {
+ Handle temp = handle_;
+ handle_ = kInvalidHandle;
+ return temp;
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/public/utility/scoped_handle.h ('k') | mojo/shell/app_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698