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

Side by Side Diff: ipc/file_descriptor_set_posix.cc

Issue 25325002: workaround for mac kernel bug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor bugfix Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ipc/file_descriptor_set_posix.h ('k') | ipc/ipc_channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <unistd.h>
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 for (std::vector<base::FileDescriptor>::iterator 119 for (std::vector<base::FileDescriptor>::iterator
120 i = descriptors_.begin(); i != descriptors_.end(); ++i) { 120 i = descriptors_.begin(); i != descriptors_.end(); ++i) {
121 if (i->auto_close) 121 if (i->auto_close)
122 if (HANDLE_EINTR(close(i->fd)) < 0) 122 if (HANDLE_EINTR(close(i->fd)) < 0)
123 PLOG(ERROR) << "close"; 123 PLOG(ERROR) << "close";
124 } 124 }
125 descriptors_.clear(); 125 descriptors_.clear();
126 consumed_descriptor_highwater_ = 0; 126 consumed_descriptor_highwater_ = 0;
127 } 127 }
128 128
129 void FileDescriptorSet::ReleaseFDsToClose(std::vector<int>* fds) {
130 for (std::vector<base::FileDescriptor>::iterator
131 i = descriptors_.begin(); i != descriptors_.end(); ++i) {
132 if (i->auto_close)
133 fds->push_back(i->fd);
134 }
135 descriptors_.clear();
136 consumed_descriptor_highwater_ = 0;
137 }
138
129 void FileDescriptorSet::SetDescriptors(const int* buffer, unsigned count) { 139 void FileDescriptorSet::SetDescriptors(const int* buffer, unsigned count) {
130 DCHECK(count <= kMaxDescriptorsPerMessage); 140 DCHECK(count <= kMaxDescriptorsPerMessage);
131 DCHECK_EQ(descriptors_.size(), 0u); 141 DCHECK_EQ(descriptors_.size(), 0u);
132 DCHECK_EQ(consumed_descriptor_highwater_, 0u); 142 DCHECK_EQ(consumed_descriptor_highwater_, 0u);
133 143
134 descriptors_.reserve(count); 144 descriptors_.reserve(count);
135 for (unsigned i = 0; i < count; ++i) { 145 for (unsigned i = 0; i < count; ++i) {
136 struct base::FileDescriptor sd; 146 struct base::FileDescriptor sd;
137 sd.fd = buffer[i]; 147 sd.fd = buffer[i];
138 sd.auto_close = true; 148 sd.auto_close = true;
139 descriptors_.push_back(sd); 149 descriptors_.push_back(sd);
140 } 150 }
141 } 151 }
OLDNEW
« no previous file with comments | « ipc/file_descriptor_set_posix.h ('k') | ipc/ipc_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698