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 10 matching lines...) Expand all Loading... |
21 if (result) { | 21 if (result) { |
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) |
| 32 : handle_(LongToHandle(wire_format.handle)), |
| 33 permissions_(wire_format.permissions), |
| 34 owns_handle_(true) {} |
| 35 |
31 HandleAttachmentWin::~HandleAttachmentWin() { | 36 HandleAttachmentWin::~HandleAttachmentWin() { |
32 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_) | 37 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_) |
33 ::CloseHandle(handle_); | 38 ::CloseHandle(handle_); |
34 } | 39 } |
35 | 40 |
36 MessageAttachment::Type HandleAttachmentWin::GetType() const { | 41 HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType() |
37 return Type::WIN_HANDLE; | 42 const { |
| 43 return WIN_HANDLE; |
| 44 } |
| 45 |
| 46 HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat( |
| 47 const base::ProcessId& destination) const { |
| 48 return WireFormat(HandleToLong(handle_), destination, permissions_); |
38 } | 49 } |
39 | 50 |
40 } // namespace internal | 51 } // namespace internal |
41 } // namespace IPC | 52 } // namespace IPC |
OLD | NEW |