Chromium Code Reviews| Index: base/sync_socket_win.cc |
| diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc |
| index 26e76ec2738e6629fbf4b0c41cc61ac0b7e7d6ec..db7689885a4b88fb5398deab0f7f294093562190 100644 |
| --- a/base/sync_socket_win.cc |
| +++ b/base/sync_socket_win.cc |
| @@ -207,6 +207,29 @@ bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { |
| return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, false); |
| } |
| +// static |
| +SyncSocket::Handle SyncSocket::UnwrapHandle( |
| + const SyncSocket::TransitDescriptor& descriptor) { |
| + return static_cast<SyncSocket::Handle>(descriptor); |
| +} |
| + |
| +bool SyncSocket::PrepareTransitDescriptor( |
| + ProcessHandle peer_process_handle, |
| + SyncSocket::TransitDescriptor* descriptor) { |
| + DCHECK(descriptor); |
| + *descriptor = 0; |
| + if (!::DuplicateHandle(GetCurrentProcess(), handle(), peer_process_handle, |
| + descriptor, 0, FALSE, DUPLICATE_SAME_ACCESS)) { |
| + DPLOG(ERROR) << "Cannot duplicate socket handle for peer process."; |
| + return false; |
| + } |
| + if (*descriptor == 0) { |
|
tommi (sloooow) - chröme
2014/09/04 17:02:25
I would remove this block. If DuplicateHandle has
burnik
2014/09/04 18:04:07
Done.
|
| + NOTREACHED() << "Socket handle duplicated but equals to zero."; |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| bool SyncSocket::Close() { |
| if (handle_ == kInvalidHandle) |
| return true; |