| 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/sync_socket.h" | 5 #include "base/sync_socket.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 0, // no sharing. | 78 0, // no sharing. |
| 79 NULL, // default security attributes. | 79 NULL, // default security attributes. |
| 80 OPEN_EXISTING, // opens existing pipe. | 80 OPEN_EXISTING, // opens existing pipe. |
| 81 flags, | 81 flags, |
| 82 NULL)); // no template file. | 82 NULL)); // no template file. |
| 83 if (!handle_b.IsValid()) { | 83 if (!handle_b.IsValid()) { |
| 84 DPLOG(ERROR) << "CreateFileW failed"; | 84 DPLOG(ERROR) << "CreateFileW failed"; |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (!ConnectNamedPipe(handle_a, NULL)) { | 88 if (!ConnectNamedPipe(handle_a.Get(), NULL)) { |
| 89 DWORD error = GetLastError(); | 89 DWORD error = GetLastError(); |
| 90 if (error != ERROR_PIPE_CONNECTED) { | 90 if (error != ERROR_PIPE_CONNECTED) { |
| 91 DPLOG(ERROR) << "ConnectNamedPipe failed"; | 91 DPLOG(ERROR) << "ConnectNamedPipe failed"; |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 *socket_a = handle_a.Take(); | 96 *socket_a = handle_a.Take(); |
| 97 *socket_b = handle_b.Take(); | 97 *socket_b = handle_b.Take(); |
| 98 | 98 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 &file_operation_, &shutdown_event_, this, timeout.InMilliseconds()); | 331 &file_operation_, &shutdown_event_, this, timeout.InMilliseconds()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 // static | 334 // static |
| 335 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, | 335 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, |
| 336 CancelableSyncSocket* socket_b) { | 336 CancelableSyncSocket* socket_b) { |
| 337 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); | 337 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace base | 340 } // namespace base |
| OLD | NEW |