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

Side by Side Diff: ipc/ipc_message.cc

Issue 1385143002: ipc: Update MachPortMac ownership semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase errors. Created 5 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
« no previous file with comments | « ipc/ipc_channel_win.cc ('k') | ipc/ipc_message_attachment_set.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) 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_message.h" 5 #include "ipc/ipc_message.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 #endif 137 #endif
138 138
139 Message::NextMessageInfo::NextMessageInfo() 139 Message::NextMessageInfo::NextMessageInfo()
140 : message_size(0), message_found(false), pickle_end(nullptr), 140 : message_size(0), message_found(false), pickle_end(nullptr),
141 message_end(nullptr) {} 141 message_end(nullptr) {}
142 Message::NextMessageInfo::~NextMessageInfo() {} 142 Message::NextMessageInfo::~NextMessageInfo() {}
143 143
144 Message::SerializedAttachmentIds 144 Message::SerializedAttachmentIds
145 Message::SerializedIdsOfBrokerableAttachments() { 145 Message::SerializedIdsOfBrokerableAttachments() {
146 DCHECK(HasBrokerableAttachments()); 146 DCHECK(HasBrokerableAttachments());
147 std::vector<const BrokerableAttachment*> attachments = 147 std::vector<BrokerableAttachment*> attachments =
148 attachment_set_->PeekBrokerableAttachments(); 148 attachment_set_->GetBrokerableAttachments();
149 CHECK_LE(attachments.size(), std::numeric_limits<size_t>::max() / 149 CHECK_LE(attachments.size(), std::numeric_limits<size_t>::max() /
150 BrokerableAttachment::kNonceSize); 150 BrokerableAttachment::kNonceSize);
151 size_t size = attachments.size() * BrokerableAttachment::kNonceSize; 151 size_t size = attachments.size() * BrokerableAttachment::kNonceSize;
152 char* buffer = static_cast<char*>(malloc(size)); 152 char* buffer = static_cast<char*>(malloc(size));
153 for (size_t i = 0; i < attachments.size(); ++i) { 153 for (size_t i = 0; i < attachments.size(); ++i) {
154 const BrokerableAttachment* attachment = attachments[i]; 154 const BrokerableAttachment* attachment = attachments[i];
155 char* start_range = buffer + i * BrokerableAttachment::kNonceSize; 155 char* start_range = buffer + i * BrokerableAttachment::kNonceSize;
156 BrokerableAttachment::AttachmentId id = attachment->GetIdentifier(); 156 BrokerableAttachment::AttachmentId id = attachment->GetIdentifier();
157 id.SerializeToBuffer(start_range, BrokerableAttachment::kNonceSize); 157 id.SerializeToBuffer(start_range, BrokerableAttachment::kNonceSize);
158 } 158 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 bool Message::HasMojoHandles() const { 265 bool Message::HasMojoHandles() const {
266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; 266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0;
267 } 267 }
268 268
269 bool Message::HasBrokerableAttachments() const { 269 bool Message::HasBrokerableAttachments() const {
270 return attachment_set_.get() && 270 return attachment_set_.get() &&
271 attachment_set_->num_brokerable_attachments() > 0; 271 attachment_set_->num_brokerable_attachments() > 0;
272 } 272 }
273 273
274 } // namespace IPC 274 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_win.cc ('k') | ipc/ipc_message_attachment_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698