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

Side by Side Diff: base/sync_socket_posix.cc

Issue 89523002: Move Posix file utils to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « base/rand_util_posix.cc ('k') | chrome/browser/chromeos/drive/drive_integration_service.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 <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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ThreadRestrictions::AssertIOAllowed(); 106 ThreadRestrictions::AssertIOAllowed();
107 return SendHelper(handle_, buffer, length); 107 return SendHelper(handle_, buffer, length);
108 } 108 }
109 109
110 size_t SyncSocket::Receive(void* buffer, size_t length) { 110 size_t SyncSocket::Receive(void* buffer, size_t length) {
111 ThreadRestrictions::AssertIOAllowed(); 111 ThreadRestrictions::AssertIOAllowed();
112 DCHECK_GT(length, 0u); 112 DCHECK_GT(length, 0u);
113 DCHECK_LE(length, kMaxMessageLength); 113 DCHECK_LE(length, kMaxMessageLength);
114 DCHECK_NE(handle_, kInvalidHandle); 114 DCHECK_NE(handle_, kInvalidHandle);
115 char* charbuffer = static_cast<char*>(buffer); 115 char* charbuffer = static_cast<char*>(buffer);
116 if (file_util::ReadFromFD(handle_, charbuffer, length)) 116 if (ReadFromFD(handle_, charbuffer, length))
117 return length; 117 return length;
118 return 0; 118 return 0;
119 } 119 }
120 120
121 size_t SyncSocket::ReceiveWithTimeout(void* buffer, 121 size_t SyncSocket::ReceiveWithTimeout(void* buffer,
122 size_t length, 122 size_t length,
123 TimeDelta timeout) { 123 TimeDelta timeout) {
124 ThreadRestrictions::AssertIOAllowed(); 124 ThreadRestrictions::AssertIOAllowed();
125 DCHECK_GT(length, 0u); 125 DCHECK_GT(length, 0u);
126 DCHECK_LE(length, kMaxMessageLength); 126 DCHECK_LE(length, kMaxMessageLength);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return len; 223 return len;
224 } 224 }
225 225
226 // static 226 // static
227 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, 227 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
228 CancelableSyncSocket* socket_b) { 228 CancelableSyncSocket* socket_b) {
229 return SyncSocket::CreatePair(socket_a, socket_b); 229 return SyncSocket::CreatePair(socket_a, socket_b);
230 } 230 }
231 231
232 } // namespace base 232 } // namespace base
OLDNEW
« no previous file with comments | « base/rand_util_posix.cc ('k') | chrome/browser/chromeos/drive/drive_integration_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698