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

Side by Side Diff: base/sync_socket_win.cc

Issue 525313002: SyncSocket Transit Descriptor - refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "base/win/scoped_handle.h" 9 #include "base/win/scoped_handle.h"
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 SyncSocket::~SyncSocket() { 201 SyncSocket::~SyncSocket() {
202 Close(); 202 Close();
203 } 203 }
204 204
205 // static 205 // static
206 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) { 206 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) {
207 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, false); 207 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, false);
208 } 208 }
209 209
210 // static
211 SyncSocket::Handle SyncSocket::UnwrapHandle(
212 const SyncSocket::TransitDescriptor& descriptor) {
213 return (SyncSocket::Handle) descriptor;
no longer working on chromium 2014/09/01 14:56:18 ditto
burnik 2014/09/01 15:08:02 Done.
214 }
215
216 bool SyncSocket::PrepareTransitDescriptor(ProcessHandle peer_process_handle,
217 SyncSocket::TransitDescriptor * descriptor) {
no longer working on chromium 2014/09/01 14:56:18 ditto
burnik 2014/09/01 14:59:34 Also TransitDescriptor* Done.
burnik 2014/09/01 15:08:03 Done.
218 // |TransitDescriptor| on Windows is the |Handle| itself
219 ::DuplicateHandle(GetCurrentProcess(), handle(),
220 peer_process_handle, descriptor,
221 0, FALSE, DUPLICATE_SAME_ACCESS);
222 return (*descriptor != 0);
223 }
224
210 bool SyncSocket::Close() { 225 bool SyncSocket::Close() {
211 if (handle_ == kInvalidHandle) 226 if (handle_ == kInvalidHandle)
212 return true; 227 return true;
213 228
214 const BOOL result = CloseHandle(handle_); 229 const BOOL result = CloseHandle(handle_);
215 handle_ = kInvalidHandle; 230 handle_ = kInvalidHandle;
216 return result == TRUE; 231 return result == TRUE;
217 } 232 }
218 233
219 size_t SyncSocket::Send(const void* buffer, size_t length) { 234 size_t SyncSocket::Send(const void* buffer, size_t length) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 &file_operation_, &shutdown_event_, this, timeout.InMilliseconds()); 323 &file_operation_, &shutdown_event_, this, timeout.InMilliseconds());
309 } 324 }
310 325
311 // static 326 // static
312 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, 327 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
313 CancelableSyncSocket* socket_b) { 328 CancelableSyncSocket* socket_b) {
314 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); 329 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true);
315 } 330 }
316 331
317 } // namespace base 332 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698