| OLD | NEW |
| 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 "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/handle_attachment_win.h" | 10 #include "ipc/handle_attachment_win.h" |
| 11 | 11 |
| 12 namespace IPC { | 12 namespace IPC { |
| 13 | 13 |
| 14 HandleWin::HandleWin() : handle_(nullptr), permissions_(INVALID) {} | |
| 15 | |
| 16 HandleWin::HandleWin(const HANDLE& handle, Permissions permissions) | 14 HandleWin::HandleWin(const HANDLE& handle, Permissions permissions) |
| 17 : handle_(handle), permissions_(permissions) {} | 15 : handle_(handle), permissions_(permissions) {} |
| 18 | 16 |
| 19 // static | 17 // static |
| 20 void ParamTraits<HandleWin>::Write(Message* m, const param_type& p) { | 18 void ParamTraits<HandleWin>::Write(Message* m, const param_type& p) { |
| 21 scoped_refptr<IPC::internal::HandleAttachmentWin> attachment( | 19 scoped_refptr<IPC::internal::HandleAttachmentWin> attachment( |
| 22 new IPC::internal::HandleAttachmentWin(p.get_handle(), | 20 new IPC::internal::HandleAttachmentWin(p.get_handle(), |
| 23 p.get_permissions())); | 21 p.get_permissions())); |
| 24 if (!m->WriteAttachment(attachment.Pass())) | 22 if (!m->WriteAttachment(attachment.Pass())) |
| 25 NOTREACHED(); | 23 NOTREACHED(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 46 return true; | 44 return true; |
| 47 } | 45 } |
| 48 | 46 |
| 49 // static | 47 // static |
| 50 void ParamTraits<HandleWin>::Log(const param_type& p, std::string* l) { | 48 void ParamTraits<HandleWin>::Log(const param_type& p, std::string* l) { |
| 51 l->append(base::StringPrintf("0x%X", p.get_handle())); | 49 l->append(base::StringPrintf("0x%X", p.get_handle())); |
| 52 l->append(base::IntToString(p.get_permissions())); | 50 l->append(base::IntToString(p.get_permissions())); |
| 53 } | 51 } |
| 54 | 52 |
| 55 } // namespace IPC | 53 } // namespace IPC |
| OLD | NEW |