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

Unified Diff: base/sync_socket_nacl.cc

Issue 10696217: Implement SyncSocket for untrusted NaCl builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sync_socket_nacl.cc
===================================================================
--- base/sync_socket_nacl.cc (revision 146234)
+++ base/sync_socket_nacl.cc (working copy)
@@ -18,7 +18,6 @@
const SyncSocket::Handle SyncSocket::kInvalidHandle = -1;
SyncSocket::SyncSocket() : handle_(kInvalidHandle) {
- NOTREACHED();
}
SyncSocket::~SyncSocket() {
@@ -30,28 +29,36 @@
}
bool SyncSocket::Close() {
- return false;
+ if (handle_ != kInvalidHandle) {
+ if (close(handle_) < 0)
+ DPLOG(ERROR) << "close";
+ handle_ = -1;
+ }
+ return true;
}
size_t SyncSocket::Send(const void* buffer, size_t length) {
- return 0;
+ // Not implemented since it's not needed by any client code yet.
+ return -1;
}
size_t SyncSocket::Receive(void* buffer, size_t length) {
- return 0;
+ return read(handle_, buffer, length);
}
size_t SyncSocket::Peek() {
- return 0;
+ return -1;
}
-CancelableSyncSocket::CancelableSyncSocket() {}
+CancelableSyncSocket::CancelableSyncSocket() {
+}
+
CancelableSyncSocket::CancelableSyncSocket(Handle handle)
: SyncSocket(handle) {
}
size_t CancelableSyncSocket::Send(const void* buffer, size_t length) {
- return 0;
+ return -1;
}
bool CancelableSyncSocket::Shutdown() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698