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

Side by Side Diff: base/sync_socket.h

Issue 1302423006: Ensure that data is not overwritten in the audio input shared memory ring buffer that sits on the b… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review. Unit test improvement. Changed read verification algorithm. Created 5 years, 3 months 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
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // |buffer| |length| is exhausted. Currently only timeouts less than one 79 // |buffer| |length| is exhausted. Currently only timeouts less than one
80 // second are allowed. Return the amount of data read. 80 // second are allowed. Return the amount of data read.
81 virtual size_t ReceiveWithTimeout(void* buffer, 81 virtual size_t ReceiveWithTimeout(void* buffer,
82 size_t length, 82 size_t length,
83 TimeDelta timeout); 83 TimeDelta timeout);
84 84
85 // Returns the number of bytes available. If non-zero, Receive() will not 85 // Returns the number of bytes available. If non-zero, Receive() will not
86 // not block when called. NOTE: Some implementations cannot reliably 86 // not block when called. NOTE: Some implementations cannot reliably
87 // determine the number of bytes available so avoid using the returned 87 // determine the number of bytes available so avoid using the returned
88 // size as a promise and simply test against zero. 88 // size as a promise and simply test against zero.
89 size_t Peek(); 89 virtual size_t Peek();
90 90
91 // Extracts the contained handle. Used for transferring between 91 // Extracts the contained handle. Used for transferring between
92 // processes. 92 // processes.
93 Handle handle() const { return handle_; } 93 Handle handle() const { return handle_; }
94 94
95 protected: 95 protected:
96 Handle handle_; 96 Handle handle_;
97 97
98 private: 98 private:
99 DISALLOW_COPY_AND_ASSIGN(SyncSocket); 99 DISALLOW_COPY_AND_ASSIGN(SyncSocket);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) 149 #if defined(OS_WIN) && !defined(COMPONENT_BUILD)
150 // TODO(cpu): remove this once chrome is split in two dlls. 150 // TODO(cpu): remove this once chrome is split in two dlls.
151 __declspec(selectany) 151 __declspec(selectany)
152 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; 152 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE;
153 #endif 153 #endif
154 154
155 } // namespace base 155 } // namespace base
156 156
157 #endif // BASE_SYNC_SOCKET_H_ 157 #endif // BASE_SYNC_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698