OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "sandbox/src/sharedmem_ipc_server.h" | 8 #include "sandbox/src/sharedmem_ipc_server.h" |
9 #include "sandbox/src/sharedmem_ipc_client.h" | 9 #include "sandbox/src/sharedmem_ipc_client.h" |
10 #include "sandbox/src/sandbox.h" | 10 #include "sandbox/src/sandbox.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return false; | 122 return false; |
123 } | 123 } |
124 // This last setting indicates to the client all is setup. | 124 // This last setting indicates to the client all is setup. |
125 client_control_->channels_count = channel_count; | 125 client_control_->channels_count = channel_count; |
126 return true; | 126 return true; |
127 } | 127 } |
128 | 128 |
129 // Releases memory allocated for IPC arguments, if needed. | 129 // Releases memory allocated for IPC arguments, if needed. |
130 void ReleaseArgs(const IPCParams* ipc_params, void* args[kMaxIpcParams]) { | 130 void ReleaseArgs(const IPCParams* ipc_params, void* args[kMaxIpcParams]) { |
131 for (size_t i = 0; i < kMaxIpcParams; i++) { | 131 for (size_t i = 0; i < kMaxIpcParams; i++) { |
132 if (args[i]) { | 132 switch (ipc_params->args[i]) { |
133 switch (ipc_params->args[i]) { | 133 case WCHAR_TYPE: { |
134 case WCHAR_TYPE: { | 134 delete reinterpret_cast<std::wstring*>(args[i]); |
135 delete reinterpret_cast<std::wstring*>(args[i]); | 135 args[i] = NULL; |
136 args[i] = NULL; | 136 break; |
137 break; | |
138 } | |
139 case INOUTPTR_TYPE: { | |
140 delete reinterpret_cast<CountedBuffer*>(args[i]); | |
141 args[i] = NULL; | |
142 break; | |
143 } | |
144 default: break; | |
145 } | 137 } |
| 138 case INOUTPTR_TYPE: { |
| 139 delete reinterpret_cast<CountedBuffer*>(args[i]); |
| 140 args[i] = NULL; |
| 141 break; |
| 142 } |
| 143 default: break; |
146 } | 144 } |
147 } | 145 } |
148 } | 146 } |
149 | 147 |
150 // Fills up the list of arguments (args and ipc_params) for an IPC call. | 148 // Fills up the list of arguments (args and ipc_params) for an IPC call. |
151 bool GetArgs(CrossCallParamsEx* params, IPCParams* ipc_params, | 149 bool GetArgs(CrossCallParamsEx* params, IPCParams* ipc_params, |
152 void* args[kMaxIpcParams]) { | 150 void* args[kMaxIpcParams]) { |
153 if (kMaxIpcParams < params->GetParamsCount()) | 151 if (kMaxIpcParams < params->GetParamsCount()) |
154 return false; | 152 return false; |
155 | 153 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 401 } |
404 *server_pong = ::CreateEventW(NULL, FALSE, FALSE, NULL); | 402 *server_pong = ::CreateEventW(NULL, FALSE, FALSE, NULL); |
405 if (!::DuplicateHandle(::GetCurrentProcess(), *server_pong, target_process_, | 403 if (!::DuplicateHandle(::GetCurrentProcess(), *server_pong, target_process_, |
406 client_pong, kDesiredAccess, FALSE, 0)) { | 404 client_pong, kDesiredAccess, FALSE, 0)) { |
407 return false; | 405 return false; |
408 } | 406 } |
409 return true; | 407 return true; |
410 } | 408 } |
411 | 409 |
412 } // namespace sandbox | 410 } // namespace sandbox |
OLD | NEW |