[M108 Migration][VD] Support set time and time zone offset
[platform/framework/web/chromium-efl.git] / base / file_descriptor_posix.cc
1 // Copyright 2021 The Chromium Authors
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 "base/file_descriptor_posix.h"
6
7 #include "base/files/file.h"
8
9 namespace base {
10
11 FileDescriptor::FileDescriptor() = default;
12
13 FileDescriptor::FileDescriptor(int ifd, bool iauto_close)
14     : fd(ifd), auto_close(iauto_close) {}
15
16 FileDescriptor::FileDescriptor(File file)
17     : fd(file.TakePlatformFile()), auto_close(true) {}
18
19 FileDescriptor::FileDescriptor(ScopedFD fd)
20     : fd(fd.release()), auto_close(true) {}
21
22 bool FileDescriptor::operator==(const FileDescriptor& other) const {
23   return fd == other.fd && auto_close == other.auto_close;
24 }
25
26 bool FileDescriptor::operator!=(const FileDescriptor& other) const {
27   return !operator==(other);
28 }
29
30 bool FileDescriptor::operator<(const FileDescriptor& other) const {
31   return other.fd < fd;
32 }
33
34 }  // namespace base