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 "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/win/src/sharedmem_ipc_server.h" | 8 #include "sandbox/win/src/sharedmem_ipc_server.h" |
9 #include "sandbox/win/src/sharedmem_ipc_client.h" | 9 #include "sandbox/win/src/sharedmem_ipc_client.h" |
10 #include "sandbox/win/src/sandbox.h" | 10 #include "sandbox/win/src/sandbox.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return; | 52 return; |
53 } | 53 } |
54 // Free the IPC signal events. | 54 // Free the IPC signal events. |
55 ServerContexts::iterator it; | 55 ServerContexts::iterator it; |
56 for (it = server_contexts_.begin(); it != server_contexts_.end(); ++it) { | 56 for (it = server_contexts_.begin(); it != server_contexts_.end(); ++it) { |
57 ServerControl* context = (*it); | 57 ServerControl* context = (*it); |
58 ::CloseHandle(context->ping_event); | 58 ::CloseHandle(context->ping_event); |
59 ::CloseHandle(context->pong_event); | 59 ::CloseHandle(context->pong_event); |
60 delete context; | 60 delete context; |
61 } | 61 } |
| 62 |
| 63 if (client_control_) |
| 64 ::UnmapViewOfFile(client_control_); |
62 } | 65 } |
63 | 66 |
64 bool SharedMemIPCServer::Init(void* shared_mem, uint32 shared_size, | 67 bool SharedMemIPCServer::Init(void* shared_mem, uint32 shared_size, |
65 uint32 channel_size) { | 68 uint32 channel_size) { |
66 // The shared memory needs to be at least as big as a channel. | 69 // The shared memory needs to be at least as big as a channel. |
67 if (shared_size < channel_size) { | 70 if (shared_size < channel_size) { |
68 return false; | 71 return false; |
69 } | 72 } |
70 // The channel size should be aligned. | 73 // The channel size should be aligned. |
71 if (0 != (channel_size % 32)) { | 74 if (0 != (channel_size % 32)) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 414 } |
412 *server_pong = ::CreateEventW(NULL, FALSE, FALSE, NULL); | 415 *server_pong = ::CreateEventW(NULL, FALSE, FALSE, NULL); |
413 if (!::DuplicateHandle(::GetCurrentProcess(), *server_pong, target_process_, | 416 if (!::DuplicateHandle(::GetCurrentProcess(), *server_pong, target_process_, |
414 client_pong, kDesiredAccess, FALSE, 0)) { | 417 client_pong, kDesiredAccess, FALSE, 0)) { |
415 return false; | 418 return false; |
416 } | 419 } |
417 return true; | 420 return true; |
418 } | 421 } |
419 | 422 |
420 } // namespace sandbox | 423 } // namespace sandbox |
OLD | NEW |