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

Side by Side Diff: tools/android/forwarder2/pipe_notifier.cc

Issue 1160373004: Move safe_strerror to posix directory and the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 6 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 | « tools/android/forwarder2/host_forwarder_main.cc ('k') | tools/android/forwarder2/socket.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 "tools/android/forwarder2/pipe_notifier.h" 5 #include "tools/android/forwarder2/pipe_notifier.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
14 #include "base/safe_strerror_posix.h"
15 14
16 namespace forwarder2 { 15 namespace forwarder2 {
17 16
18 PipeNotifier::PipeNotifier() { 17 PipeNotifier::PipeNotifier() {
19 int pipe_fd[2]; 18 int pipe_fd[2];
20 int ret = pipe(pipe_fd); 19 int ret = pipe(pipe_fd);
21 CHECK_EQ(0, ret); 20 CHECK_EQ(0, ret);
22 receiver_fd_ = pipe_fd[0]; 21 receiver_fd_ = pipe_fd[0];
23 sender_fd_ = pipe_fd[1]; 22 sender_fd_ = pipe_fd[1];
24 fcntl(sender_fd_, F_SETFL, O_NONBLOCK); 23 fcntl(sender_fd_, F_SETFL, O_NONBLOCK);
(...skipping 20 matching lines...) Expand all
45 int ret = HANDLE_EINTR(read(receiver_fd_, &c, 1)); 44 int ret = HANDLE_EINTR(read(receiver_fd_, &c, 1));
46 if (ret < 0) { 45 if (ret < 0) {
47 PLOG(ERROR) << "read"; 46 PLOG(ERROR) << "read";
48 return; 47 return;
49 } 48 }
50 DCHECK_EQ(1, ret); 49 DCHECK_EQ(1, ret);
51 DCHECK_EQ('1', c); 50 DCHECK_EQ('1', c);
52 } 51 }
53 52
54 } // namespace forwarder 53 } // namespace forwarder
OLDNEW
« no previous file with comments | « tools/android/forwarder2/host_forwarder_main.cc ('k') | tools/android/forwarder2/socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698