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

Unified Diff: dbus/file_descriptor.h

Issue 1108083003: Re-land Move ScopedFileDescriptor to dbus/file_descriptor.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 | « chromeos/network/firewall_hole.cc ('k') | dbus/file_descriptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/file_descriptor.h
diff --git a/dbus/file_descriptor.h b/dbus/file_descriptor.h
index 19e0b1ab44b32da4b419a5bef30fbcc4cb386a75..a01ee6ee0115815a951fd5b9005adbf7445bdd2a 100644
--- a/dbus/file_descriptor.h
+++ b/dbus/file_descriptor.h
@@ -6,6 +6,7 @@
#define DBUS_FILE_DESCRIPTOR_H_
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "dbus/dbus_export.h"
namespace dbus {
@@ -33,6 +34,12 @@ namespace dbus {
// with i/o restrictions.
class CHROME_DBUS_EXPORT FileDescriptor {
public:
+ // This provides a simple way to pass around file descriptors since they must
+ // be closed on a thread that is allowed to perform I/O.
+ struct Deleter {
+ void CHROME_DBUS_EXPORT operator()(FileDescriptor* fd);
+ };
+
// Permits initialization without a value for passing to
// dbus::MessageReader::PopFileDescriptor to fill in and from int values.
FileDescriptor() : value_(-1), owner_(false), valid_(false) {}
@@ -70,6 +77,9 @@ class CHROME_DBUS_EXPORT FileDescriptor {
DISALLOW_COPY_AND_ASSIGN(FileDescriptor);
};
+using ScopedFileDescriptor =
+ scoped_ptr<FileDescriptor, FileDescriptor::Deleter>;
+
} // namespace dbus
#endif // DBUS_FILE_DESCRIPTOR_H_
« no previous file with comments | « chromeos/network/firewall_hole.cc ('k') | dbus/file_descriptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698