| 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 #ifndef BASE_SYNC_SOCKET_H_ | 5 #ifndef BASE_SYNC_SOCKET_H_ |
| 6 #define BASE_SYNC_SOCKET_H_ | 6 #define BASE_SYNC_SOCKET_H_ |
| 7 | 7 |
| 8 // A socket abstraction used for sending and receiving plain | 8 // A socket abstraction used for sending and receiving plain |
| 9 // data. Because the receiving is blocking, they can be used to perform | 9 // data. Because the receiving is blocking, they can be used to perform |
| 10 // rudimentary cross-process synchronization with low latency. | 10 // rudimentary cross-process synchronization with low latency. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 TimeDelta timeout); | 86 TimeDelta timeout); |
| 87 | 87 |
| 88 // Returns the number of bytes available. If non-zero, Receive() will not | 88 // Returns the number of bytes available. If non-zero, Receive() will not |
| 89 // not block when called. | 89 // not block when called. |
| 90 virtual size_t Peek(); | 90 virtual size_t Peek(); |
| 91 | 91 |
| 92 // Extracts the contained handle. Used for transferring between | 92 // Extracts the contained handle. Used for transferring between |
| 93 // processes. | 93 // processes. |
| 94 Handle handle() const { return handle_; } | 94 Handle handle() const { return handle_; } |
| 95 | 95 |
| 96 // Extracts and takes ownership of the contained handle. |
| 97 Handle Release(); |
| 98 |
| 96 protected: | 99 protected: |
| 97 Handle handle_; | 100 Handle handle_; |
| 98 | 101 |
| 99 private: | 102 private: |
| 100 DISALLOW_COPY_AND_ASSIGN(SyncSocket); | 103 DISALLOW_COPY_AND_ASSIGN(SyncSocket); |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 // Derives from SyncSocket and adds support for shutting down the socket from | 106 // Derives from SyncSocket and adds support for shutting down the socket from |
| 104 // another thread while a blocking Receive or Send is being done from the | 107 // another thread while a blocking Receive or Send is being done from the |
| 105 // thread that owns the socket. | 108 // thread that owns the socket. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 152 |
| 150 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) | 153 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) |
| 151 // TODO(cpu): remove this once chrome is split in two dlls. | 154 // TODO(cpu): remove this once chrome is split in two dlls. |
| 152 __declspec(selectany) | 155 __declspec(selectany) |
| 153 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; | 156 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; |
| 154 #endif | 157 #endif |
| 155 | 158 |
| 156 } // namespace base | 159 } // namespace base |
| 157 | 160 |
| 158 #endif // BASE_SYNC_SOCKET_H_ | 161 #endif // BASE_SYNC_SOCKET_H_ |
| OLD | NEW |