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/win/scoped_handle.h" | 8 #include "base/win/scoped_handle.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Quit the operation if we can't write/read anymore. | 161 // Quit the operation if we can't write/read anymore. |
162 if (len != chunk) | 162 if (len != chunk) |
163 break; | 163 break; |
164 } | 164 } |
165 | 165 |
166 return (count > 0) ? count : 0; | 166 return (count > 0) ? count : 0; |
167 } | 167 } |
168 | 168 |
169 } // namespace | 169 } // namespace |
170 | 170 |
| 171 #if defined(COMPONENT_BUILD) |
171 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; | 172 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; |
| 173 #endif |
172 | 174 |
173 SyncSocket::SyncSocket() : handle_(kInvalidHandle) {} | 175 SyncSocket::SyncSocket() : handle_(kInvalidHandle) {} |
174 | 176 |
175 SyncSocket::~SyncSocket() { | 177 SyncSocket::~SyncSocket() { |
176 Close(); | 178 Close(); |
177 } | 179 } |
178 | 180 |
179 // static | 181 // static |
180 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { | 182 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { |
181 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, false); | 183 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, false); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 264 } |
263 | 265 |
264 // static | 266 // static |
265 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, | 267 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, |
266 CancelableSyncSocket* socket_b) { | 268 CancelableSyncSocket* socket_b) { |
267 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); | 269 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); |
268 } | 270 } |
269 | 271 |
270 | 272 |
271 } // namespace base | 273 } // namespace base |
OLD | NEW |