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

Side by Side Diff: ipc/ipc_message.cc

Issue 1659003003: IPC::Message -> base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more mac fix Created 4 years, 10 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.h ('k') | ipc/ipc_message_attachment.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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 info->message_found = true; 233 info->message_found = true;
234 } 234 }
235 235
236 bool Message::AddPlaceholderBrokerableAttachmentWithId( 236 bool Message::AddPlaceholderBrokerableAttachmentWithId(
237 BrokerableAttachment::AttachmentId id) { 237 BrokerableAttachment::AttachmentId id) {
238 scoped_refptr<PlaceholderBrokerableAttachment> attachment( 238 scoped_refptr<PlaceholderBrokerableAttachment> attachment(
239 new PlaceholderBrokerableAttachment(id)); 239 new PlaceholderBrokerableAttachment(id));
240 return attachment_set()->AddAttachment(attachment); 240 return attachment_set()->AddAttachment(attachment);
241 } 241 }
242 242
243 bool Message::WriteAttachment(scoped_refptr<MessageAttachment> attachment) { 243 bool Message::WriteAttachment(
244 scoped_refptr<base::Pickle::Attachment> attachment) {
244 bool brokerable; 245 bool brokerable;
245 size_t index; 246 size_t index;
246 bool success = 247 bool success = attachment_set()->AddAttachment(
247 attachment_set()->AddAttachment(attachment, &index, &brokerable); 248 make_scoped_refptr(static_cast<MessageAttachment*>(attachment.get())),
249 &index, &brokerable);
248 DCHECK(success); 250 DCHECK(success);
249 251
250 // Write the type of descriptor. 252 // Write the type of descriptor.
251 WriteBool(brokerable); 253 WriteBool(brokerable);
252 254
253 // Write the index of the descriptor so that we don't have to 255 // Write the index of the descriptor so that we don't have to
254 // keep the current descriptor as extra decoding state when deserialising. 256 // keep the current descriptor as extra decoding state when deserialising.
255 WriteInt(static_cast<int>(index)); 257 WriteInt(static_cast<int>(index));
256 258
257 #if USE_ATTACHMENT_BROKER 259 #if USE_ATTACHMENT_BROKER
258 if (brokerable) 260 if (brokerable)
259 header()->num_brokered_attachments++; 261 header()->num_brokered_attachments++;
260 #endif 262 #endif
261 263
262 return success; 264 return success;
263 } 265 }
264 266
265 bool Message::ReadAttachment( 267 bool Message::ReadAttachment(
266 base::PickleIterator* iter, 268 base::PickleIterator* iter,
267 scoped_refptr<MessageAttachment>* attachment) const { 269 scoped_refptr<base::Pickle::Attachment>* attachment) const {
268 bool brokerable; 270 bool brokerable;
269 if (!iter->ReadBool(&brokerable)) 271 if (!iter->ReadBool(&brokerable))
270 return false; 272 return false;
271 273
272 int index; 274 int index;
273 if (!iter->ReadInt(&index)) 275 if (!iter->ReadInt(&index))
274 return false; 276 return false;
275 277
276 MessageAttachmentSet* attachment_set = attachment_set_.get(); 278 MessageAttachmentSet* attachment_set = attachment_set_.get();
277 if (!attachment_set) 279 if (!attachment_set)
(...skipping 13 matching lines...) Expand all
291 bool Message::HasMojoHandles() const { 293 bool Message::HasMojoHandles() const {
292 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; 294 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0;
293 } 295 }
294 296
295 bool Message::HasBrokerableAttachments() const { 297 bool Message::HasBrokerableAttachments() const {
296 return attachment_set_.get() && 298 return attachment_set_.get() &&
297 attachment_set_->num_brokerable_attachments() > 0; 299 attachment_set_->num_brokerable_attachments() > 0;
298 } 300 }
299 301
300 } // namespace IPC 302 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message.h ('k') | ipc/ipc_message_attachment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698