OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "ipc/file_descriptor_set_posix.h" | 5 #include "ipc/file_descriptor_set_posix.h" |
6 | 6 |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 i = descriptors_.begin(); i != descriptors_.end(); ++i) { | 115 i = descriptors_.begin(); i != descriptors_.end(); ++i) { |
116 if (i->auto_close) | 116 if (i->auto_close) |
117 if (HANDLE_EINTR(close(i->fd)) < 0) | 117 if (HANDLE_EINTR(close(i->fd)) < 0) |
118 PLOG(ERROR) << "close"; | 118 PLOG(ERROR) << "close"; |
119 } | 119 } |
120 descriptors_.clear(); | 120 descriptors_.clear(); |
121 consumed_descriptor_highwater_ = 0; | 121 consumed_descriptor_highwater_ = 0; |
122 } | 122 } |
123 | 123 |
124 void FileDescriptorSet::SetDescriptors(const int* buffer, unsigned count) { | 124 void FileDescriptorSet::SetDescriptors(const int* buffer, unsigned count) { |
125 DCHECK_LE(count, MAX_DESCRIPTORS_PER_MESSAGE); | 125 DCHECK_LE(count, static_cast<unsigned>(MAX_DESCRIPTORS_PER_MESSAGE)); |
Nico
2011/08/19 20:34:23
for msvc i assume. else revert
| |
126 DCHECK_EQ(descriptors_.size(), 0u); | 126 DCHECK_EQ(descriptors_.size(), 0u); |
127 DCHECK_EQ(consumed_descriptor_highwater_, 0u); | 127 DCHECK_EQ(consumed_descriptor_highwater_, 0u); |
128 | 128 |
129 descriptors_.reserve(count); | 129 descriptors_.reserve(count); |
130 for (unsigned i = 0; i < count; ++i) { | 130 for (unsigned i = 0; i < count; ++i) { |
131 struct base::FileDescriptor sd; | 131 struct base::FileDescriptor sd; |
132 sd.fd = buffer[i]; | 132 sd.fd = buffer[i]; |
133 sd.auto_close = true; | 133 sd.auto_close = true; |
134 descriptors_.push_back(sd); | 134 descriptors_.push_back(sd); |
135 } | 135 } |
136 } | 136 } |
OLD | NEW |