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

Side by Side Diff: base/sync_socket_posix.cc

Issue 525313002: SyncSocket Transit Descriptor - refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK on posix for descriptor pointer Created 6 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 #include "base/sync_socket.h" 5 #include "base/sync_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <limits.h> 9 #include <limits.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 #endif 90 #endif
91 91
92 // Copy the handles out for successful return. 92 // Copy the handles out for successful return.
93 socket_a->handle_ = handles[0]; 93 socket_a->handle_ = handles[0];
94 socket_b->handle_ = handles[1]; 94 socket_b->handle_ = handles[1];
95 95
96 return true; 96 return true;
97 } 97 }
98 98
99 // static
100 SyncSocket::Handle SyncSocket::UnwrapHandle(
101 const TransitDescriptor& descriptor) {
102 return descriptor.fd;
103 }
104
105 bool SyncSocket::PrepareTransitDescriptor(ProcessHandle peer_process_handle,
106 TransitDescriptor* descriptor) {
107 DCHECK(descriptor);
tommi (sloooow) - chröme 2014/09/04 19:47:00 nit: we generally don't add DCHECKs like this when
burnik 2014/09/06 18:17:10 Done.
108 descriptor->fd = handle();
109 descriptor->auto_close = false;
110 return descriptor->fd != kInvalidHandle;
111 }
112
99 bool SyncSocket::Close() { 113 bool SyncSocket::Close() {
100 const bool retval = CloseHandle(handle_); 114 const bool retval = CloseHandle(handle_);
101 handle_ = kInvalidHandle; 115 handle_ = kInvalidHandle;
102 return retval; 116 return retval;
103 } 117 }
104 118
105 size_t SyncSocket::Send(const void* buffer, size_t length) { 119 size_t SyncSocket::Send(const void* buffer, size_t length) {
106 ThreadRestrictions::AssertIOAllowed(); 120 ThreadRestrictions::AssertIOAllowed();
107 return SendHelper(handle_, buffer, length); 121 return SendHelper(handle_, buffer, length);
108 } 122 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return len; 237 return len;
224 } 238 }
225 239
226 // static 240 // static
227 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, 241 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
228 CancelableSyncSocket* socket_b) { 242 CancelableSyncSocket* socket_b) {
229 return SyncSocket::CreatePair(socket_a, socket_b); 243 return SyncSocket::CreatePair(socket_a, socket_b);
230 } 244 }
231 245
232 } // namespace base 246 } // namespace base
OLDNEW
« no previous file with comments | « base/sync_socket_nacl.cc ('k') | base/sync_socket_win.cc » ('j') | base/sync_socket_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698