OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <limits.h> | 6 #include <limits.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 ((length - count) <= UINT_MAX) ? (length - count) : UINT_MAX); | 134 ((length - count) <= UINT_MAX) ? (length - count) : UINT_MAX); |
135 if (ReadFile(handle_, static_cast<char*>(buffer) + count, | 135 if (ReadFile(handle_, static_cast<char*>(buffer) + count, |
136 chunk, &len, NULL) == FALSE) { | 136 chunk, &len, NULL) == FALSE) { |
137 return (0 < count) ? count : 0; | 137 return (0 < count) ? count : 0; |
138 } | 138 } |
139 count += len; | 139 count += len; |
140 } | 140 } |
141 return count; | 141 return count; |
142 } | 142 } |
143 | 143 |
| 144 size_t SyncSocket::Peek() { |
| 145 DWORD available = 0; |
| 146 PeekNamedPipe(handle_, NULL, 0, NULL, &available, NULL); |
| 147 return available; |
| 148 } |
| 149 |
144 } // namespace base | 150 } // namespace base |
OLD | NEW |