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

Side by Side Diff: ipc/ipc_message_attachment_set.cc

Issue 1286883003: Revert of IPC: Add attachment brokering support to the message header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ipc/ipc_message_attachment_set.h ('k') | ipc/ipc_message_start.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/ipc_message_attachment_set.h" 5 #include "ipc/ipc_message_attachment_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/posix/eintr_wrapper.h" 9 #include "base/posix/eintr_wrapper.h"
10 #include "ipc/brokerable_attachment.h" 10 #include "ipc/brokerable_attachment.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 std::vector<const BrokerableAttachment*> output; 136 std::vector<const BrokerableAttachment*> output;
137 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) { 137 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) {
138 if (attachment->GetType() == 138 if (attachment->GetType() ==
139 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) { 139 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) {
140 output.push_back(static_cast<BrokerableAttachment*>(attachment.get())); 140 output.push_back(static_cast<BrokerableAttachment*>(attachment.get()));
141 } 141 }
142 } 142 }
143 return output; 143 return output;
144 } 144 }
145 145
146 void MessageAttachmentSet::ReplacePlaceholderWithAttachment( 146 std::vector<scoped_refptr<BrokerableAttachment>>
147 const scoped_refptr<BrokerableAttachment>& attachment) { 147 MessageAttachmentSet::GetBrokerableAttachmentsForUpdating() {
148 for (auto it = attachments_.begin(); it != attachments_.end(); ++it) { 148 std::vector<scoped_refptr<BrokerableAttachment>> output;
149 if ((*it)->GetType() != MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) 149 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) {
150 continue; 150 if (attachment->GetType() ==
151 BrokerableAttachment* brokerable_attachment = 151 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) {
152 static_cast<BrokerableAttachment*>(it->get()); 152 output.push_back(scoped_refptr<BrokerableAttachment>(
153 153 static_cast<BrokerableAttachment*>(attachment.get())));
154 if (brokerable_attachment->GetBrokerableType() ==
155 BrokerableAttachment::PLACEHOLDER &&
156 brokerable_attachment->GetIdentifier() == attachment->GetIdentifier()) {
157 *it = attachment;
158 return;
159 } 154 }
160 } 155 }
161 156 return output;
162 // This function should only be called if there is a placeholder ready to be
163 // replaced.
164 NOTREACHED();
165 } 157 }
166 158
167 #if defined(OS_POSIX) 159 #if defined(OS_POSIX)
168 160
169 void MessageAttachmentSet::PeekDescriptors(base::PlatformFile* buffer) const { 161 void MessageAttachmentSet::PeekDescriptors(base::PlatformFile* buffer) const {
170 for (size_t i = 0; i != attachments_.size(); ++i) 162 for (size_t i = 0; i != attachments_.size(); ++i)
171 buffer[i] = internal::GetPlatformFile(attachments_[i]); 163 buffer[i] = internal::GetPlatformFile(attachments_[i]);
172 } 164 }
173 165
174 bool MessageAttachmentSet::ContainsDirectoryDescriptor() const { 166 bool MessageAttachmentSet::ContainsDirectoryDescriptor() const {
(...skipping 29 matching lines...) Expand all
204 for (unsigned i = 0; i < count; ++i) 196 for (unsigned i = 0; i < count; ++i)
205 AddAttachment( 197 AddAttachment(
206 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i]))); 198 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i])));
207 } 199 }
208 200
209 #endif // OS_POSIX 201 #endif // OS_POSIX
210 202
211 } // namespace IPC 203 } // namespace IPC
212 204
213 205
OLDNEW
« no previous file with comments | « ipc/ipc_message_attachment_set.h ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698