| 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_attachment_win.h" | 5 #include "ipc/handle_attachment_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 namespace IPC { | 9 namespace IPC { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 handle_ = duplicated_handle; | 22 handle_ = duplicated_handle; |
| 23 permissions_ = permissions; | 23 permissions_ = permissions; |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle, | 27 HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle, |
| 28 FromWire from_wire) | 28 FromWire from_wire) |
| 29 : handle_(handle), permissions_(HandleWin::INVALID), owns_handle_(true) {} | 29 : handle_(handle), permissions_(HandleWin::INVALID), owns_handle_(true) {} |
| 30 | 30 |
| 31 HandleAttachmentWin::HandleAttachmentWin(const WireFormat& wire_format) | 31 HandleAttachmentWin::HandleAttachmentWin(const WireFormat& wire_format) |
| 32 : BrokerableAttachment(wire_format.attachment_id), | 32 : handle_(LongToHandle(wire_format.handle)), |
| 33 handle_(LongToHandle(wire_format.handle)), | |
| 34 permissions_(wire_format.permissions), | 33 permissions_(wire_format.permissions), |
| 35 owns_handle_(true) {} | 34 owns_handle_(true) {} |
| 36 | 35 |
| 37 HandleAttachmentWin::~HandleAttachmentWin() { | 36 HandleAttachmentWin::~HandleAttachmentWin() { |
| 38 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_) | 37 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_) |
| 39 ::CloseHandle(handle_); | 38 ::CloseHandle(handle_); |
| 40 } | 39 } |
| 41 | 40 |
| 42 HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType() | 41 HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType() |
| 43 const { | 42 const { |
| 44 return WIN_HANDLE; | 43 return WIN_HANDLE; |
| 45 } | 44 } |
| 46 | 45 |
| 47 HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat( | 46 HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat( |
| 48 const base::ProcessId& destination) const { | 47 const base::ProcessId& destination) const { |
| 49 return WireFormat(HandleToLong(handle_), destination, permissions_, | 48 return WireFormat(HandleToLong(handle_), destination, permissions_); |
| 50 GetIdentifier()); | |
| 51 } | 49 } |
| 52 | 50 |
| 53 } // namespace internal | 51 } // namespace internal |
| 54 } // namespace IPC | 52 } // namespace IPC |
| OLD | NEW |