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

Side by Side Diff: base/sync_socket_posix.cc

Issue 8368009: Replace most LOG statements with DLOG statements in base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/shared_memory_win.cc ('k') | base/synchronization/condition_variable_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <limits.h> 8 #include <limits.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Copy the handles out for successful return. 62 // Copy the handles out for successful return.
63 tmp_sockets[0]->handle_ = handles[0]; 63 tmp_sockets[0]->handle_ = handles[0];
64 pair[0] = tmp_sockets[0]; 64 pair[0] = tmp_sockets[0];
65 tmp_sockets[1]->handle_ = handles[1]; 65 tmp_sockets[1]->handle_ = handles[1];
66 pair[1] = tmp_sockets[1]; 66 pair[1] = tmp_sockets[1];
67 return true; 67 return true;
68 68
69 cleanup: 69 cleanup:
70 if (handles[0] != kInvalidHandle) { 70 if (handles[0] != kInvalidHandle) {
71 if (HANDLE_EINTR(close(handles[0])) < 0) 71 if (HANDLE_EINTR(close(handles[0])) < 0)
72 PLOG(ERROR) << "close"; 72 DPLOG(ERROR) << "close";
73 } 73 }
74 if (handles[1] != kInvalidHandle) { 74 if (handles[1] != kInvalidHandle) {
75 if (HANDLE_EINTR(close(handles[1])) < 0) 75 if (HANDLE_EINTR(close(handles[1])) < 0)
76 PLOG(ERROR) << "close"; 76 DPLOG(ERROR) << "close";
77 } 77 }
78 delete tmp_sockets[0]; 78 delete tmp_sockets[0];
79 delete tmp_sockets[1]; 79 delete tmp_sockets[1];
80 return false; 80 return false;
81 } 81 }
82 82
83 bool SyncSocket::Close() { 83 bool SyncSocket::Close() {
84 if (handle_ == kInvalidHandle) { 84 if (handle_ == kInvalidHandle) {
85 return false; 85 return false;
86 } 86 }
87 int retval = HANDLE_EINTR(close(handle_)); 87 int retval = HANDLE_EINTR(close(handle_));
88 if (retval < 0) 88 if (retval < 0)
89 PLOG(ERROR) << "close"; 89 DPLOG(ERROR) << "close";
90 handle_ = kInvalidHandle; 90 handle_ = kInvalidHandle;
91 return (retval == 0); 91 return (retval == 0);
92 } 92 }
93 93
94 size_t SyncSocket::Send(const void* buffer, size_t length) { 94 size_t SyncSocket::Send(const void* buffer, size_t length) {
95 DCHECK_LE(length, kMaxMessageLength); 95 DCHECK_LE(length, kMaxMessageLength);
96 const char* charbuffer = static_cast<const char*>(buffer); 96 const char* charbuffer = static_cast<const char*>(buffer);
97 int len = file_util::WriteFileDescriptor(handle_, charbuffer, length); 97 int len = file_util::WriteFileDescriptor(handle_, charbuffer, length);
98 return static_cast<size_t>(len); 98 return static_cast<size_t>(len);
99 } 99 }
(...skipping 11 matching lines...) Expand all
111 size_t SyncSocket::Peek() { 111 size_t SyncSocket::Peek() {
112 int number_chars; 112 int number_chars;
113 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) { 113 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) {
114 // If there is an error in ioctl, signal that the channel would block. 114 // If there is an error in ioctl, signal that the channel would block.
115 return 0; 115 return 0;
116 } 116 }
117 return (size_t) number_chars; 117 return (size_t) number_chars;
118 } 118 }
119 119
120 } // namespace base 120 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory_win.cc ('k') | base/synchronization/condition_variable_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698