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

Side by Side Diff: base/sync_socket_win.cc

Issue 1350493002: Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK to CHECK 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 #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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 DPLOG(ERROR) << "Cannot duplicate socket handle for peer process."; 228 DPLOG(ERROR) << "Cannot duplicate socket handle for peer process.";
229 return false; 229 return false;
230 } 230 }
231 return true; 231 return true;
232 } 232 }
233 233
234 bool SyncSocket::Close() { 234 bool SyncSocket::Close() {
235 if (handle_ == kInvalidHandle) 235 if (handle_ == kInvalidHandle)
236 return true; 236 return true;
237 237
238 const BOOL result = CloseHandle(handle_); 238 const BOOL result = ::CloseHandle(handle_);
239 CHECK(result);
Lei Zhang 2015/09/22 08:03:30 Also PCHECK()
239 handle_ = kInvalidHandle; 240 handle_ = kInvalidHandle;
240 return result == TRUE; 241 return result == TRUE;
241 } 242 }
242 243
243 size_t SyncSocket::Send(const void* buffer, size_t length) { 244 size_t SyncSocket::Send(const void* buffer, size_t length) {
244 ThreadRestrictions::AssertIOAllowed(); 245 ThreadRestrictions::AssertIOAllowed();
245 DCHECK_GT(length, 0u); 246 DCHECK_GT(length, 0u);
246 DCHECK_LE(length, kMaxMessageLength); 247 DCHECK_LE(length, kMaxMessageLength);
247 DCHECK_NE(handle_, kInvalidHandle); 248 DCHECK_NE(handle_, kInvalidHandle);
248 size_t count = 0; 249 size_t count = 0;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 static_cast<DWORD>(timeout.InMilliseconds())); 334 static_cast<DWORD>(timeout.InMilliseconds()));
334 } 335 }
335 336
336 // static 337 // static
337 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, 338 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
338 CancelableSyncSocket* socket_b) { 339 CancelableSyncSocket* socket_b) {
339 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); 340 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true);
340 } 341 }
341 342
342 } // namespace base 343 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698