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

Side by Side Diff: content/browser/file_descriptor_info_impl.cc

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/file_descriptor_info_impl.h" 5 #include "content/browser/file_descriptor_info_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool FileDescriptorInfoImpl::HasID(int id) const { 45 bool FileDescriptorInfoImpl::HasID(int id) const {
46 for (unsigned i = 0; i < mapping_.size(); ++i) { 46 for (unsigned i = 0; i < mapping_.size(); ++i) {
47 if (mapping_[i].second == id) 47 if (mapping_[i].second == id)
48 return true; 48 return true;
49 } 49 }
50 50
51 return false; 51 return false;
52 } 52 }
53 53
54 bool FileDescriptorInfoImpl::OwnsFD(base::PlatformFile file) const { 54 bool FileDescriptorInfoImpl::OwnsFD(base::PlatformFile file) const {
55 return ContainsValue(owned_descriptors_, file); 55 return base::ContainsValue(owned_descriptors_, file);
56 } 56 }
57 57
58 base::ScopedFD FileDescriptorInfoImpl::ReleaseFD(base::PlatformFile file) { 58 base::ScopedFD FileDescriptorInfoImpl::ReleaseFD(base::PlatformFile file) {
59 DCHECK(OwnsFD(file)); 59 DCHECK(OwnsFD(file));
60 60
61 base::ScopedFD fd; 61 base::ScopedFD fd;
62 auto found = 62 auto found =
63 std::find(owned_descriptors_.begin(), owned_descriptors_.end(), file); 63 std::find(owned_descriptors_.begin(), owned_descriptors_.end(), file);
64 64
65 std::swap(*found, fd); 65 std::swap(*found, fd);
(...skipping 15 matching lines...) Expand all
81 base::FileHandleMappingVector 81 base::FileHandleMappingVector
82 FileDescriptorInfoImpl::GetMappingWithIDAdjustment(int delta) const { 82 FileDescriptorInfoImpl::GetMappingWithIDAdjustment(int delta) const {
83 base::FileHandleMappingVector result = mapping_; 83 base::FileHandleMappingVector result = mapping_;
84 // Adding delta to each ID. 84 // Adding delta to each ID.
85 for (unsigned i = 0; i < mapping_.size(); ++i) 85 for (unsigned i = 0; i < mapping_.size(); ++i)
86 result[i].second += delta; 86 result[i].second += delta;
87 return result; 87 return result;
88 } 88 }
89 89
90 } // namespace content 90 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_package.cc ('k') | content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698