OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <unistd.h> |
9 | 10 |
10 #include "base/eintr_wrapper.h" | 11 #include "base/eintr_wrapper.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 | 13 |
13 FileDescriptorSet::FileDescriptorSet() | 14 FileDescriptorSet::FileDescriptorSet() |
14 : consumed_descriptor_highwater_(0) { | 15 : consumed_descriptor_highwater_(0) { |
15 } | 16 } |
16 | 17 |
17 FileDescriptorSet::~FileDescriptorSet() { | 18 FileDescriptorSet::~FileDescriptorSet() { |
18 if (consumed_descriptor_highwater_ == descriptors_.size()) | 19 if (consumed_descriptor_highwater_ == descriptors_.size()) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 DCHECK_EQ(consumed_descriptor_highwater_, 0u); | 128 DCHECK_EQ(consumed_descriptor_highwater_, 0u); |
128 | 129 |
129 descriptors_.reserve(count); | 130 descriptors_.reserve(count); |
130 for (unsigned i = 0; i < count; ++i) { | 131 for (unsigned i = 0; i < count; ++i) { |
131 struct base::FileDescriptor sd; | 132 struct base::FileDescriptor sd; |
132 sd.fd = buffer[i]; | 133 sd.fd = buffer[i]; |
133 sd.auto_close = true; | 134 sd.auto_close = true; |
134 descriptors_.push_back(sd); | 135 descriptors_.push_back(sd); |
135 } | 136 } |
136 } | 137 } |
OLD | NEW |