| Index: content/browser/file_descriptor_info_impl.cc
|
| diff --git a/content/browser/file_descriptor_info_impl.cc b/content/browser/file_descriptor_info_impl.cc
|
| index c6cf831e6258333c8a3a1ad148d1bca7a8440ef5..f071b426d5850318d481bb2592ae119022a7ef6f 100644
|
| --- a/content/browser/file_descriptor_info_impl.cc
|
| +++ b/content/browser/file_descriptor_info_impl.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include <utility>
|
|
|
| +#include "base/stl_util.h"
|
| +
|
| namespace content {
|
|
|
| // static
|
| @@ -25,7 +27,7 @@ void FileDescriptorInfoImpl::Share(int id, base::PlatformFile fd) {
|
|
|
| void FileDescriptorInfoImpl::Transfer(int id, base::ScopedFD fd) {
|
| AddToMapping(id, fd.get());
|
| - owned_descriptors_.push_back(new base::ScopedFD(std::move(fd)));
|
| + owned_descriptors_.push_back(std::move(fd));
|
| }
|
|
|
| base::PlatformFile FileDescriptorInfoImpl::GetFDAt(size_t i) const {
|
| @@ -50,21 +52,17 @@ bool FileDescriptorInfoImpl::HasID(int id) const {
|
| }
|
|
|
| bool FileDescriptorInfoImpl::OwnsFD(base::PlatformFile file) const {
|
| - return owned_descriptors_.end() !=
|
| - std::find_if(
|
| - owned_descriptors_.begin(), owned_descriptors_.end(),
|
| - [file](const base::ScopedFD* fd) { return fd->get() == file; });
|
| + return ContainsValue(owned_descriptors_, file);
|
| }
|
|
|
| base::ScopedFD FileDescriptorInfoImpl::ReleaseFD(base::PlatformFile file) {
|
| DCHECK(OwnsFD(file));
|
|
|
| base::ScopedFD fd;
|
| - auto found = std::find_if(
|
| - owned_descriptors_.begin(), owned_descriptors_.end(),
|
| - [file](const base::ScopedFD* fd) { return fd->get() == file; });
|
| + auto found =
|
| + std::find(owned_descriptors_.begin(), owned_descriptors_.end(), file);
|
|
|
| - (*found)->swap(fd);
|
| + std::swap(*found, fd);
|
| owned_descriptors_.erase(found);
|
|
|
| return fd;
|
|
|