summaryrefslogtreecommitdiffstats
path: root/chromium/base/file_descriptor_posix.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/base/file_descriptor_posix.h')
-rw-r--r--chromium/base/file_descriptor_posix.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/chromium/base/file_descriptor_posix.h b/chromium/base/file_descriptor_posix.h
index abc07893faf..c730be65f74 100644
--- a/chromium/base/file_descriptor_posix.h
+++ b/chromium/base/file_descriptor_posix.h
@@ -5,6 +5,8 @@
#ifndef BASE_FILE_DESCRIPTOR_POSIX_H_
#define BASE_FILE_DESCRIPTOR_POSIX_H_
+#include "base/files/file.h"
+
namespace base {
// -----------------------------------------------------------------------------
@@ -16,18 +18,21 @@ namespace base {
// above the template specialisation for this structure.
// -----------------------------------------------------------------------------
struct FileDescriptor {
- FileDescriptor()
- : fd(-1),
- auto_close(false) { }
+ FileDescriptor() : fd(-1), auto_close(false) {}
+
+ FileDescriptor(int ifd, bool iauto_close) : fd(ifd), auto_close(iauto_close) {
+ }
- FileDescriptor(int ifd, bool iauto_close)
- : fd(ifd),
- auto_close(iauto_close) { }
+ FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true) {}
bool operator==(const FileDescriptor& other) const {
return (fd == other.fd && auto_close == other.auto_close);
}
+ bool operator!=(const FileDescriptor& other) const {
+ return !operator==(other);
+ }
+
// A comparison operator so that we can use these as keys in a std::map.
bool operator<(const FileDescriptor& other) const {
return other.fd < fd;