| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ | 5 #ifndef SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ |
| 6 #define SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ | 6 #define SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ |
| 7 | 7 |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "sandbox/win/src/crosscall_params.h" | 8 #include "sandbox/win/src/crosscall_params.h" |
| 12 #include "sandbox/win/src/sandbox.h" | 9 #include "sandbox/win/src/sandbox.h" |
| 13 | 10 |
| 14 // IPC transport implementation that uses shared memory. | 11 // IPC transport implementation that uses shared memory. |
| 15 // This is the client side | 12 // This is the client side |
| 16 // | 13 // |
| 17 // The shared memory is divided on blocks called channels, and potentially | 14 // The shared memory is divided on blocks called channels, and potentially |
| 18 // it can perform as many concurrent IPC calls as channels. The IPC over | 15 // it can perform as many concurrent IPC calls as channels. The IPC over |
| 19 // each channel is strictly synchronous for the client. | 16 // each channel is strictly synchronous for the client. |
| 20 // | 17 // |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // points to be beginning of the channel buffer, where data goes | 74 // points to be beginning of the channel buffer, where data goes |
| 78 size_t channel_base; | 75 size_t channel_base; |
| 79 // maintains the state from the ChannelState enumeration | 76 // maintains the state from the ChannelState enumeration |
| 80 volatile LONG state; | 77 volatile LONG state; |
| 81 // the ping event is signaled by the client when the IPC data is ready on | 78 // the ping event is signaled by the client when the IPC data is ready on |
| 82 // the buffer | 79 // the buffer |
| 83 HANDLE ping_event; | 80 HANDLE ping_event; |
| 84 // the client waits on the pong event for the IPC answer back | 81 // the client waits on the pong event for the IPC answer back |
| 85 HANDLE pong_event; | 82 HANDLE pong_event; |
| 86 // the IPC unique identifier | 83 // the IPC unique identifier |
| 87 uint32_t ipc_tag; | 84 uint32 ipc_tag; |
| 88 }; | 85 }; |
| 89 | 86 |
| 90 struct IPCControl { | 87 struct IPCControl { |
| 91 // total number of channels available, some might be busy at a given time | 88 // total number of channels available, some might be busy at a given time |
| 92 size_t channels_count; | 89 size_t channels_count; |
| 93 // handle to a shared mutex to detect when the server is dead | 90 // handle to a shared mutex to detect when the server is dead |
| 94 HANDLE server_alive; | 91 HANDLE server_alive; |
| 95 // array of channel control structures | 92 // array of channel control structures |
| 96 ChannelControl channels[1]; | 93 ChannelControl channels[1]; |
| 97 }; | 94 }; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Return the channel index given the address of the buffer. | 127 // Return the channel index given the address of the buffer. |
| 131 size_t ChannelIndexFromBuffer(const void* buffer); | 128 size_t ChannelIndexFromBuffer(const void* buffer); |
| 132 IPCControl* control_; | 129 IPCControl* control_; |
| 133 // point to the first channel base | 130 // point to the first channel base |
| 134 char* first_base_; | 131 char* first_base_; |
| 135 }; | 132 }; |
| 136 | 133 |
| 137 } // namespace sandbox | 134 } // namespace sandbox |
| 138 | 135 |
| 139 #endif // SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ | 136 #endif // SANDBOX_SRC_SHAREDMEM_IPC_CLIENT_H__ |
| OLD | NEW |