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

Side by Side Diff: ipc/ipc_channel_reader.cc

Issue 1414503009: IPC: Remove unnecessary conversions of BrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. Created 5 years, 1 month 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_channel_posix.cc ('k') | ipc/ipc_channel_reader_unittest.cc » ('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) 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 "ipc/ipc_channel_reader.h" 5 #include "ipc/ipc_channel_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "ipc/ipc_listener.h" 10 #include "ipc/ipc_listener.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 return DISPATCH_FINISHED; 244 return DISPATCH_FINISHED;
245 } 245 }
246 246
247 ChannelReader::AttachmentIdSet ChannelReader::GetBrokeredAttachments( 247 ChannelReader::AttachmentIdSet ChannelReader::GetBrokeredAttachments(
248 Message* msg) { 248 Message* msg) {
249 std::set<BrokerableAttachment::AttachmentId> blocked_ids; 249 std::set<BrokerableAttachment::AttachmentId> blocked_ids;
250 250
251 #if USE_ATTACHMENT_BROKER 251 #if USE_ATTACHMENT_BROKER
252 MessageAttachmentSet* set = msg->attachment_set(); 252 MessageAttachmentSet* set = msg->attachment_set();
253 std::vector<BrokerableAttachment*> brokerable_attachments_copy = 253 std::vector<scoped_refptr<IPC::BrokerableAttachment>>
254 set->GetBrokerableAttachments(); 254 brokerable_attachments_copy(set->GetBrokerableAttachments());
255 for (const BrokerableAttachment* attachment : brokerable_attachments_copy) { 255 for (const auto& attachment : brokerable_attachments_copy) {
256 if (attachment->NeedsBrokering()) { 256 if (attachment->NeedsBrokering()) {
257 AttachmentBroker* broker = GetAttachmentBroker(); 257 AttachmentBroker* broker = GetAttachmentBroker();
258 DCHECK(broker); 258 DCHECK(broker);
259 scoped_refptr<BrokerableAttachment> brokered_attachment; 259 scoped_refptr<BrokerableAttachment> brokered_attachment;
260 bool result = broker->GetAttachmentWithId(attachment->GetIdentifier(), 260 bool result = broker->GetAttachmentWithId(attachment->GetIdentifier(),
261 &brokered_attachment); 261 &brokered_attachment);
262 if (!result) { 262 if (!result) {
263 blocked_ids.insert(attachment->GetIdentifier()); 263 blocked_ids.insert(attachment->GetIdentifier());
264 continue; 264 continue;
265 } 265 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (size <= Channel::kMaximumMessageSize) { 303 if (size <= Channel::kMaximumMessageSize) {
304 return true; 304 return true;
305 } 305 }
306 input_overflow_buf_.clear(); 306 input_overflow_buf_.clear();
307 LOG(ERROR) << "IPC message is too big: " << size; 307 LOG(ERROR) << "IPC message is too big: " << size;
308 return false; 308 return false;
309 } 309 }
310 310
311 } // namespace internal 311 } // namespace internal
312 } // namespace IPC 312 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698