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 <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 const SyncSocket::Handle SyncSocket::kInvalidHandle = -1; | 16 const SyncSocket::Handle SyncSocket::kInvalidHandle = -1; |
17 | 17 |
18 SyncSocket::SyncSocket() : handle_(kInvalidHandle) { | 18 SyncSocket::SyncSocket() : handle_(kInvalidHandle) { |
19 } | 19 } |
20 | 20 |
21 SyncSocket::~SyncSocket() { | 21 SyncSocket::~SyncSocket() { |
22 Close(); | 22 Close(); |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { | 26 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { |
27 return false; | 27 return false; |
28 } | 28 } |
29 | 29 |
| 30 // static |
| 31 SyncSocket::Handle SyncSocket::UnwrapHandle( |
| 32 const SyncSocket::TransitDescriptor& descriptor) { |
| 33 // TODO(xians): Still unclear how NaCl uses SyncSocket. |
| 34 // See http://crbug.com/409656 |
| 35 NOTIMPLEMENTED(); |
| 36 return SyncSocket::kInvalidHandle; |
| 37 } |
| 38 |
| 39 bool SyncSocket::PrepareTransitDescriptor( |
| 40 ProcessHandle peer_process_handle, |
| 41 SyncSocket::TransitDescriptor* descriptor) { |
| 42 // TODO(xians): Still unclear how NaCl uses SyncSocket. |
| 43 // See http://crbug.com/409656 |
| 44 NOTIMPLEMENTED(); |
| 45 return false; |
| 46 } |
| 47 |
30 bool SyncSocket::Close() { | 48 bool SyncSocket::Close() { |
31 if (handle_ != kInvalidHandle) { | 49 if (handle_ != kInvalidHandle) { |
32 if (close(handle_) < 0) | 50 if (close(handle_) < 0) |
33 DPLOG(ERROR) << "close"; | 51 DPLOG(ERROR) << "close"; |
34 handle_ = kInvalidHandle; | 52 handle_ = kInvalidHandle; |
35 } | 53 } |
36 return true; | 54 return true; |
37 } | 55 } |
38 | 56 |
39 size_t SyncSocket::Send(const void* buffer, size_t length) { | 57 size_t SyncSocket::Send(const void* buffer, size_t length) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return SyncSocket::Close(); | 89 return SyncSocket::Close(); |
72 } | 90 } |
73 | 91 |
74 // static | 92 // static |
75 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, | 93 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, |
76 CancelableSyncSocket* socket_b) { | 94 CancelableSyncSocket* socket_b) { |
77 return SyncSocket::CreatePair(socket_a, socket_b); | 95 return SyncSocket::CreatePair(socket_a, socket_b); |
78 } | 96 } |
79 | 97 |
80 } // namespace base | 98 } // namespace base |
OLD | NEW |