Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1054)

Unified Diff: content/browser/file_descriptor_info_impl.cc

Issue 1508213002: Replace ScopedVector<ScopedFD> with std::vector<ScopedFD> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert gratuitous .at(0) change back to [0] Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7a61402f9eb9813e7ff7410584f6336901b2d978 100644
--- a/content/browser/file_descriptor_info_impl.cc
+++ b/content/browser/file_descriptor_info_impl.cc
@@ -25,7 +25,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 {
@@ -53,7 +53,7 @@ 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; });
+ [file](const base::ScopedFD& fd) { return fd.get() == file; });
}
base::ScopedFD FileDescriptorInfoImpl::ReleaseFD(base::PlatformFile file) {
@@ -62,9 +62,9 @@ base::ScopedFD FileDescriptorInfoImpl::ReleaseFD(base::PlatformFile file) {
base::ScopedFD fd;
auto found = std::find_if(
danakj 2015/12/08 23:44:48 can't these just be std::find(foo.begin(), foo.end
mdempsky 2015/12/09 00:45:37 Huh, I didn't realize you could use == between a b
owned_descriptors_.begin(), owned_descriptors_.end(),
- [file](const base::ScopedFD* fd) { return fd->get() == file; });
+ [file](const base::ScopedFD& fd) { return fd.get() == file; });
- (*found)->swap(fd);
+ found->swap(fd);
danakj 2015/12/08 23:44:48 std::swap?
mdempsky 2015/12/09 00:45:37 Done. (Is there a reason to prefer that? Just ge
danakj 2015/12/09 00:48:43 Yah, I think so. Not really a big deal either way,
owned_descriptors_.erase(found);
return fd;

Powered by Google App Engine
This is Rietveld 408576698