| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 SharedMemIPCServer::~SharedMemIPCServer() { | 57 SharedMemIPCServer::~SharedMemIPCServer() { |
| 58 // Free the wait handles associated with the thread pool. | 58 // Free the wait handles associated with the thread pool. |
| 59 if (!thread_provider_->UnRegisterWaits(this)) { | 59 if (!thread_provider_->UnRegisterWaits(this)) { |
| 60 // Better to leak than to crash. | 60 // Better to leak than to crash. |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 STLDeleteElements(&server_contexts_); | 63 base::STLDeleteElements(&server_contexts_); |
| 64 | 64 |
| 65 if (client_control_) | 65 if (client_control_) |
| 66 ::UnmapViewOfFile(client_control_); | 66 ::UnmapViewOfFile(client_control_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool SharedMemIPCServer::Init(void* shared_mem, | 69 bool SharedMemIPCServer::Init(void* shared_mem, |
| 70 uint32_t shared_size, | 70 uint32_t shared_size, |
| 71 uint32_t channel_size) { | 71 uint32_t channel_size) { |
| 72 // The shared memory needs to be at least as big as a channel. | 72 // The shared memory needs to be at least as big as a channel. |
| 73 if (shared_size < channel_size) { | 73 if (shared_size < channel_size) { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 server_pong->Set(::CreateEventW(NULL, FALSE, FALSE, NULL)); | 420 server_pong->Set(::CreateEventW(NULL, FALSE, FALSE, NULL)); |
| 421 if (!::DuplicateHandle(::GetCurrentProcess(), server_pong->Get(), | 421 if (!::DuplicateHandle(::GetCurrentProcess(), server_pong->Get(), |
| 422 target_process_, client_pong, kDesiredAccess, FALSE, | 422 target_process_, client_pong, kDesiredAccess, FALSE, |
| 423 0)) { | 423 0)) { |
| 424 return false; | 424 return false; |
| 425 } | 425 } |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace sandbox | 429 } // namespace sandbox |
| OLD | NEW |