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

Side by Side Diff: ipc/handle_win.cc

Issue 2504063002: Revert of Remove IPC::BrokerableAttachment. (Closed)
Patch Set: Created 4 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/handle_attachment_win.cc ('k') | ipc/ipc_channel_mojo.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/handle_win.h" 5 #include "ipc/handle_win.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 20 matching lines...) Expand all
31 31
32 // static 32 // static
33 bool ParamTraits<HandleWin>::Read(const base::Pickle* m, 33 bool ParamTraits<HandleWin>::Read(const base::Pickle* m,
34 base::PickleIterator* iter, 34 base::PickleIterator* iter,
35 param_type* r) { 35 param_type* r) {
36 scoped_refptr<base::Pickle::Attachment> base_attachment; 36 scoped_refptr<base::Pickle::Attachment> base_attachment;
37 if (!m->ReadAttachment(iter, &base_attachment)) 37 if (!m->ReadAttachment(iter, &base_attachment))
38 return false; 38 return false;
39 MessageAttachment* attachment = 39 MessageAttachment* attachment =
40 static_cast<MessageAttachment*>(base_attachment.get()); 40 static_cast<MessageAttachment*>(base_attachment.get());
41 if (attachment->GetType() != MessageAttachment::Type::WIN_HANDLE) 41 if (attachment->GetType() != MessageAttachment::TYPE_BROKERABLE_ATTACHMENT)
42 return false; 42 return false;
43 BrokerableAttachment* brokerable_attachment =
44 static_cast<BrokerableAttachment*>(attachment);
45 if (brokerable_attachment->GetBrokerableType() !=
46 BrokerableAttachment::WIN_HANDLE) {
47 return false;
48 }
43 IPC::internal::HandleAttachmentWin* handle_attachment = 49 IPC::internal::HandleAttachmentWin* handle_attachment =
44 static_cast<IPC::internal::HandleAttachmentWin*>(attachment); 50 static_cast<IPC::internal::HandleAttachmentWin*>(brokerable_attachment);
45 r->set_handle(handle_attachment->get_handle()); 51 r->set_handle(handle_attachment->get_handle());
46 handle_attachment->reset_handle_ownership(); 52 handle_attachment->reset_handle_ownership();
47 return true; 53 return true;
48 } 54 }
49 55
50 // static 56 // static
51 void ParamTraits<HandleWin>::Log(const param_type& p, std::string* l) { 57 void ParamTraits<HandleWin>::Log(const param_type& p, std::string* l) {
52 l->append(base::StringPrintf("0x%p", p.get_handle())); 58 l->append(base::StringPrintf("0x%p", p.get_handle()));
53 l->append(base::IntToString(p.get_permissions())); 59 l->append(base::IntToString(p.get_permissions()));
54 } 60 }
55 61
56 } // namespace IPC 62 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/handle_attachment_win.cc ('k') | ipc/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698