Index: ui/ozone/platform/drm/host/drm_device_handle.cc |
diff --git a/ui/ozone/platform/drm/host/drm_device_handle.cc b/ui/ozone/platform/drm/host/drm_device_handle.cc |
index 36d5a8373099b551cb468478f2b2829343a7672f..8d9fc0c53af256964ff95b8175229814145ae113 100644 |
--- a/ui/ozone/platform/drm/host/drm_device_handle.cc |
+++ b/ui/ozone/platform/drm/host/drm_device_handle.cc |
@@ -30,7 +30,8 @@ DrmDeviceHandle::DrmDeviceHandle() { |
} |
DrmDeviceHandle::~DrmDeviceHandle() { |
- base::ThreadRestrictions::AssertIOAllowed(); |
+ if (file_.is_valid()) |
+ base::ThreadRestrictions::AssertIOAllowed(); |
} |
bool DrmDeviceHandle::Initialize(const base::FilePath& path) { |
@@ -63,15 +64,8 @@ bool DrmDeviceHandle::IsValid() const { |
return file_.is_valid(); |
} |
-base::ScopedFD DrmDeviceHandle::Duplicate() { |
- DCHECK(file_.is_valid()); |
- int fd = dup(file_.get()); |
- if (fd < 0) { |
- PLOG(ERROR) << "Failed to dup"; |
- return base::ScopedFD(); |
- } |
- |
- return base::ScopedFD(fd); |
+base::ScopedFD DrmDeviceHandle::PassFD() { |
+ return file_.Pass(); |
} |
} // namespace ui |