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

Side by Side Diff: base/sync_socket.h

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 | « no previous file | base/sync_socket_posix.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 #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 they are blocking, they can be used to perform 9 // data. Because they are blocking, they can be used to perform
10 // rudimentary cross-process synchronization with low latency. 10 // rudimentary cross-process synchronization with low latency.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // length is the length of the data to send (must be non-zero). 44 // length is the length of the data to send (must be non-zero).
45 // Returns the number of bytes sent, or 0 upon failure. 45 // Returns the number of bytes sent, or 0 upon failure.
46 size_t Send(const void* buffer, size_t length); 46 size_t Send(const void* buffer, size_t length);
47 47
48 // Receives a message from an SyncSocket. 48 // Receives a message from an SyncSocket.
49 // buffer is a pointer to the buffer to receive data. 49 // buffer is a pointer to the buffer to receive data.
50 // length is the number of bytes of data to receive (must be non-zero). 50 // length is the number of bytes of data to receive (must be non-zero).
51 // Returns the number of bytes received, or 0 upon failure. 51 // Returns the number of bytes received, or 0 upon failure.
52 size_t Receive(void* buffer, size_t length); 52 size_t Receive(void* buffer, size_t length);
53 53
54 // Returns the number of bytes available. If non-zero, Receive() will not
55 // not block when called. NOTE: Some implementations cannot reliably
56 // determine the number of bytes available so avoid using the returned
57 // size as a promise and simply test against zero.
58 size_t Peek();
59
54 // Extracts the contained handle. Used for transferring between 60 // Extracts the contained handle. Used for transferring between
55 // processes. 61 // processes.
56 Handle handle() const { return handle_; } 62 Handle handle() const { return handle_; }
57 63
58 private: 64 private:
59 Handle handle_; 65 Handle handle_;
60 66
61 DISALLOW_COPY_AND_ASSIGN(SyncSocket); 67 DISALLOW_COPY_AND_ASSIGN(SyncSocket);
62 }; 68 };
63 69
64 } // namespace base 70 } // namespace base
65 71
66 #endif // BASE_SYNC_SOCKET_H_ 72 #endif // BASE_SYNC_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | base/sync_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698