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

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: Fixed log call expectations for Android in unit test. Rebase. 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/audio_input_renderer_host.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) 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 virtual size_t Receive(void* buffer, size_t length); 76 virtual size_t Receive(void* buffer, size_t length);
77 77
78 // Same as Receive() but only blocks for data until |timeout| has elapsed or 78 // Same as Receive() but only blocks for data until |timeout| has elapsed or
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.
87 // determine the number of bytes available so avoid using the returned 87 virtual size_t Peek();
88 // size as a promise and simply test against zero.
89 size_t Peek();
90 88
91 // Extracts the contained handle. Used for transferring between 89 // Extracts the contained handle. Used for transferring between
92 // processes. 90 // processes.
93 Handle handle() const { return handle_; } 91 Handle handle() const { return handle_; }
94 92
95 protected: 93 protected:
96 Handle handle_; 94 Handle handle_;
97 95
98 private: 96 private:
99 DISALLOW_COPY_AND_ASSIGN(SyncSocket); 97 DISALLOW_COPY_AND_ASSIGN(SyncSocket);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 146
149 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) 147 #if defined(OS_WIN) && !defined(COMPONENT_BUILD)
150 // TODO(cpu): remove this once chrome is split in two dlls. 148 // TODO(cpu): remove this once chrome is split in two dlls.
151 __declspec(selectany) 149 __declspec(selectany)
152 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE; 150 const SyncSocket::Handle SyncSocket::kInvalidHandle = INVALID_HANDLE_VALUE;
153 #endif 151 #endif
154 152
155 } // namespace base 153 } // namespace base
156 154
157 #endif // BASE_SYNC_SOCKET_H_ 155 #endif // BASE_SYNC_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/audio_input_renderer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698