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

Side by Side Diff: ipc/mach_port_mac.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/mach_port_mac.h ('k') | ipc/mojo/ipc_channel_mojo_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mach_port_mac.h" 5 #include "ipc/mach_port_mac.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "ipc/mach_port_attachment_mac.h" 10 #include "ipc/mach_port_attachment_mac.h"
11 11
12 namespace IPC { 12 namespace IPC {
13 13
14 // static 14 // static
15 void ParamTraits<MachPortMac>::Write(Message* m, const param_type& p) { 15 void ParamTraits<MachPortMac>::Write(base::Pickle* m, const param_type& p) {
16 if (!m->WriteAttachment( 16 if (!m->WriteAttachment(
17 new IPC::internal::MachPortAttachmentMac(p.get_mach_port()))) { 17 new IPC::internal::MachPortAttachmentMac(p.get_mach_port()))) {
18 NOTREACHED(); 18 NOTREACHED();
19 } 19 }
20 } 20 }
21 21
22 // static 22 // static
23 bool ParamTraits<MachPortMac>::Read(const Message* m, 23 bool ParamTraits<MachPortMac>::Read(const base::Pickle* m,
24 base::PickleIterator* iter, 24 base::PickleIterator* iter,
25 param_type* r) { 25 param_type* r) {
26 scoped_refptr<MessageAttachment> attachment; 26 scoped_refptr<base::Pickle::Attachment> base_attachment;
27 if (!m->ReadAttachment(iter, &attachment)) 27 if (!m->ReadAttachment(iter, &base_attachment))
28 return false; 28 return false;
29 MessageAttachment* attachment =
30 static_cast<MessageAttachment*>(base_attachment.get());
29 if (attachment->GetType() != MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) 31 if (attachment->GetType() != MessageAttachment::TYPE_BROKERABLE_ATTACHMENT)
30 return false; 32 return false;
31 BrokerableAttachment* brokerable_attachment = 33 BrokerableAttachment* brokerable_attachment =
32 static_cast<BrokerableAttachment*>(attachment.get()); 34 static_cast<BrokerableAttachment*>(attachment);
33 if (brokerable_attachment->GetBrokerableType() != 35 if (brokerable_attachment->GetBrokerableType() !=
34 BrokerableAttachment::MACH_PORT) { 36 BrokerableAttachment::MACH_PORT) {
35 return false; 37 return false;
36 } 38 }
37 IPC::internal::MachPortAttachmentMac* mach_port_attachment = 39 IPC::internal::MachPortAttachmentMac* mach_port_attachment =
38 static_cast<IPC::internal::MachPortAttachmentMac*>(brokerable_attachment); 40 static_cast<IPC::internal::MachPortAttachmentMac*>(brokerable_attachment);
39 r->set_mach_port(mach_port_attachment->get_mach_port()); 41 r->set_mach_port(mach_port_attachment->get_mach_port());
40 mach_port_attachment->reset_mach_port_ownership(); 42 mach_port_attachment->reset_mach_port_ownership();
41 return true; 43 return true;
42 } 44 }
43 45
44 // static 46 // static
45 void ParamTraits<MachPortMac>::Log(const param_type& p, std::string* l) { 47 void ParamTraits<MachPortMac>::Log(const param_type& p, std::string* l) {
46 l->append(base::StringPrintf("mach port: 0x%X", p.get_mach_port())); 48 l->append(base::StringPrintf("mach port: 0x%X", p.get_mach_port()));
47 } 49 }
48 50
49 } // namespace IPC 51 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mach_port_mac.h ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698