Index: dbus/file_descriptor.cc |
diff --git a/dbus/file_descriptor.cc b/dbus/file_descriptor.cc |
index 91b089f657cf271e5240e05e24be4f1eca9b6452..d2d6a31f1e3cdc091a2497d04aa6da62c79f3633 100644 |
--- a/dbus/file_descriptor.cc |
+++ b/dbus/file_descriptor.cc |
@@ -2,15 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/files/file.h" |
#include "base/logging.h" |
-#include "base/platform_file.h" |
#include "dbus/file_descriptor.h" |
namespace dbus { |
FileDescriptor::~FileDescriptor() { |
if (owner_) |
- base::ClosePlatformFile(value_); |
+ base::File auto_closer(value_); |
} |
int FileDescriptor::value() const { |
@@ -25,8 +25,10 @@ int FileDescriptor::TakeValue() { |
} |
void FileDescriptor::CheckValidity() { |
- base::PlatformFileInfo info; |
- bool ok = base::GetPlatformFileInfo(value_, &info); |
+ base::File file(value_); |
+ base::File::Info info; |
+ bool ok = file.GetInfo(&info); |
+ file.TakePlatformFile(); // Prevent |value_| from being closed by |file|. |
valid_ = (ok && !info.is_directory); |
} |