| 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 #ifndef IPC_HANDLE_ATTACHMENT_WIN_H_ | 5 #ifndef IPC_HANDLE_ATTACHMENT_WIN_H_ |
| 6 #define IPC_HANDLE_ATTACHMENT_WIN_H_ | 6 #define IPC_HANDLE_ATTACHMENT_WIN_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 struct IPC_EXPORT WireFormat { | 22 struct IPC_EXPORT WireFormat { |
| 23 // IPC translation requires that classes passed through IPC have a default | 23 // IPC translation requires that classes passed through IPC have a default |
| 24 // constructor. | 24 // constructor. |
| 25 WireFormat() | 25 WireFormat() |
| 26 : handle(0), | 26 : handle(0), |
| 27 destination_process(0), | 27 destination_process(0), |
| 28 permissions(HandleWin::INVALID) {} | 28 permissions(HandleWin::INVALID) {} |
| 29 | 29 |
| 30 WireFormat(int32_t handle, | 30 WireFormat(int32_t handle, |
| 31 const base::ProcessId& destination_process, | 31 const base::ProcessId& destination_process, |
| 32 HandleWin::Permissions permissions, | 32 HandleWin::Permissions permissions) |
| 33 const AttachmentId& attachment_id) | |
| 34 : handle(handle), | 33 : handle(handle), |
| 35 destination_process(destination_process), | 34 destination_process(destination_process), |
| 36 permissions(permissions), | 35 permissions(permissions) {} |
| 37 attachment_id(attachment_id) {} | |
| 38 | 36 |
| 39 // The HANDLE that is intended for duplication, or the HANDLE that has been | 37 // The HANDLE that is intended for duplication, or the HANDLE that has been |
| 40 // duplicated, depending on context. | 38 // duplicated, depending on context. |
| 41 // The type is int32_t instead of HANDLE because HANDLE gets typedefed to | 39 // The type is int32_t instead of HANDLE because HANDLE gets typedefed to |
| 42 // void*, whose size varies between 32 and 64-bit processes. Using a | 40 // void*, whose size varies between 32 and 64-bit processes. Using a |
| 43 // int32_t means that 64-bit processes will need to perform both up-casting | 41 // int32_t means that 64-bit processes will need to perform both up-casting |
| 44 // and down-casting. This is performed using the appropriate Windows APIs. | 42 // and down-casting. This is performed using the appropriate Windows APIs. |
| 45 // A value of 0 is equivalent to an invalid handle. | 43 // A value of 0 is equivalent to an invalid handle. |
| 46 int32_t handle; | 44 int32_t handle; |
| 47 | 45 |
| 48 // The id of the destination process that the handle is duplicated into. | 46 // The id of the destination process that the handle is duplicated into. |
| 49 base::ProcessId destination_process; | 47 base::ProcessId destination_process; |
| 50 | 48 |
| 51 // The permissions to use when duplicating the handle. | 49 // The permissions to use when duplicating the handle. |
| 52 HandleWin::Permissions permissions; | 50 HandleWin::Permissions permissions; |
| 53 | |
| 54 AttachmentId attachment_id; | |
| 55 }; | 51 }; |
| 56 | 52 |
| 57 // This constructor makes a copy of |handle| and takes ownership of the | 53 // This constructor makes a copy of |handle| and takes ownership of the |
| 58 // result. Should only be called by the sender of a Chrome IPC message. | 54 // result. Should only be called by the sender of a Chrome IPC message. |
| 59 HandleAttachmentWin(const HANDLE& handle, HandleWin::Permissions permissions); | 55 HandleAttachmentWin(const HANDLE& handle, HandleWin::Permissions permissions); |
| 60 | 56 |
| 61 enum FromWire { | 57 enum FromWire { |
| 62 FROM_WIRE, | 58 FROM_WIRE, |
| 63 }; | 59 }; |
| 64 // This constructor takes ownership of |handle|. Should only be called by the | 60 // This constructor takes ownership of |handle|. Should only be called by the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 92 // this member to |false|. | 88 // this member to |false|. |
| 93 // In the destination process, the attachment owns the Mach port until a call | 89 // In the destination process, the attachment owns the Mach port until a call |
| 94 // to ParamTraits<HandleWin>::Read() takes ownership. | 90 // to ParamTraits<HandleWin>::Read() takes ownership. |
| 95 bool owns_handle_; | 91 bool owns_handle_; |
| 96 }; | 92 }; |
| 97 | 93 |
| 98 } // namespace internal | 94 } // namespace internal |
| 99 } // namespace IPC | 95 } // namespace IPC |
| 100 | 96 |
| 101 #endif // IPC_HANDLE_ATTACHMENT_WIN_H_ | 97 #endif // IPC_HANDLE_ATTACHMENT_WIN_H_ |
| OLD | NEW |