OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DBUS_FILE_DESCRIPTOR_H_ | 5 #ifndef DBUS_FILE_DESCRIPTOR_H_ |
6 #define DBUS_FILE_DESCRIPTOR_H_ | 6 #define DBUS_FILE_DESCRIPTOR_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
9 #include "base/move.h" | 10 #include "base/move.h" |
10 #include "dbus/dbus_export.h" | 11 #include "dbus/dbus_export.h" |
11 | 12 |
12 namespace dbus { | 13 namespace dbus { |
13 | 14 |
14 // FileDescriptor is a type used to encapsulate D-Bus file descriptors | 15 // FileDescriptor is a type used to encapsulate D-Bus file descriptors |
15 // and to follow the RAII idiom appropiate for use with message operations | 16 // and to follow the RAII idiom appropiate for use with message operations |
16 // where the descriptor might be easily leaked. To guard against this the | 17 // where the descriptor might be easily leaked. To guard against this the |
17 // descriptor is closed when an instance is destroyed if it is owned. | 18 // descriptor is closed when an instance is destroyed if it is owned. |
18 // Ownership is asserted only when PutValue is used and TakeValue can be | 19 // Ownership is asserted only when PutValue is used and TakeValue can be |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 private: | 79 private: |
79 void Swap(FileDescriptor* other); | 80 void Swap(FileDescriptor* other); |
80 | 81 |
81 int value_; | 82 int value_; |
82 bool owner_; | 83 bool owner_; |
83 bool valid_; | 84 bool valid_; |
84 }; | 85 }; |
85 | 86 |
86 using ScopedFileDescriptor = | 87 using ScopedFileDescriptor = |
87 scoped_ptr<FileDescriptor, FileDescriptor::Deleter>; | 88 std::unique_ptr<FileDescriptor, FileDescriptor::Deleter>; |
88 | 89 |
89 } // namespace dbus | 90 } // namespace dbus |
90 | 91 |
91 #endif // DBUS_FILE_DESCRIPTOR_H_ | 92 #endif // DBUS_FILE_DESCRIPTOR_H_ |
OLD | NEW |