Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Side by Side Diff: base/sync_socket_win.cc

Issue 464020: Add non-blocking peek for the syncsocket... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/sync_socket_posix.cc ('k') | ipc/sync_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « base/sync_socket_posix.cc ('k') | ipc/sync_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698