OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/public/utility/scoped_handle.h" |
| 6 |
| 7 namespace mojo { |
| 8 |
| 9 ScopedHandle::ScopedHandle(Handle handle) : handle_(handle) { |
| 10 } |
| 11 |
| 12 ScopedHandle::~ScopedHandle() { |
| 13 if (handle_.value == kInvalidHandle.value) |
| 14 return; |
| 15 Close(handle_); |
| 16 Release(); |
| 17 } |
| 18 |
| 19 Handle ScopedHandle::Release() { |
| 20 Handle temp = handle_; |
| 21 handle_ = kInvalidHandle; |
| 22 return temp; |
| 23 } |
| 24 |
| 25 } // namespace mojo |
OLD | NEW |