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

Side by Side Diff: base/sync_socket_win.cc

Issue 656033009: Convert ARRAYSIZE_UNSAFE -> arraysize in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « base/strings/utf_string_conversions_unittest.cc ('k') | base/version_unittest.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 #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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const DWORD chunk = GetNextChunkSize(count, length); 143 const DWORD chunk = GetNextChunkSize(count, length);
144 // This is either the ReadFile or WriteFile call depending on whether 144 // This is either the ReadFile or WriteFile call depending on whether
145 // we're receiving or sending data. 145 // we're receiving or sending data.
146 DWORD len = 0; 146 DWORD len = 0;
147 const BOOL operation_ok = operation( 147 const BOOL operation_ok = operation(
148 file, static_cast<BufferType*>(buffer) + count, chunk, &len, &ol); 148 file, static_cast<BufferType*>(buffer) + count, chunk, &len, &ol);
149 if (!operation_ok) { 149 if (!operation_ok) {
150 if (::GetLastError() == ERROR_IO_PENDING) { 150 if (::GetLastError() == ERROR_IO_PENDING) {
151 HANDLE events[] = { io_event->handle(), cancel_event->handle() }; 151 HANDLE events[] = { io_event->handle(), cancel_event->handle() };
152 const int wait_result = WaitForMultipleObjects( 152 const int wait_result = WaitForMultipleObjects(
153 ARRAYSIZE_UNSAFE(events), events, FALSE, 153 arraysize(events), events, FALSE,
154 timeout_in_ms == INFINITE ? 154 timeout_in_ms == INFINITE ?
155 timeout_in_ms : 155 timeout_in_ms :
156 static_cast<DWORD>( 156 static_cast<DWORD>(
157 (finish_time - current_time).InMilliseconds())); 157 (finish_time - current_time).InMilliseconds()));
158 if (wait_result != WAIT_OBJECT_0 + 0) { 158 if (wait_result != WAIT_OBJECT_0 + 0) {
159 // CancelIo() doesn't synchronously cancel outstanding IO, only marks 159 // CancelIo() doesn't synchronously cancel outstanding IO, only marks
160 // outstanding IO for cancellation. We must call GetOverlappedResult() 160 // outstanding IO for cancellation. We must call GetOverlappedResult()
161 // below to ensure in flight writes complete before returning. 161 // below to ensure in flight writes complete before returning.
162 CancelIo(file); 162 CancelIo(file);
163 } 163 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 static_cast<DWORD>(timeout.InMilliseconds())); 333 static_cast<DWORD>(timeout.InMilliseconds()));
334 } 334 }
335 335
336 // static 336 // static
337 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, 337 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
338 CancelableSyncSocket* socket_b) { 338 CancelableSyncSocket* socket_b) {
339 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true); 339 return CreatePairImpl(&socket_a->handle_, &socket_b->handle_, true);
340 } 340 }
341 341
342 } // namespace base 342 } // namespace base
OLDNEW
« no previous file with comments | « base/strings/utf_string_conversions_unittest.cc ('k') | base/version_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698