| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/forwarders_manager.h" | 5 #include "tools/android/forwarder2/forwarders_manager.h" |
| 6 | 6 |
| 7 #include <sys/select.h> | 7 #include <sys/select.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 it != forwarders_.end(); ++it) { | 74 it != forwarders_.end(); ++it) { |
| 75 Forwarder* const forwarder = *it; | 75 Forwarder* const forwarder = *it; |
| 76 forwarder->RegisterFDs(&read_fds, &write_fds, &max_fd); | 76 forwarder->RegisterFDs(&read_fds, &write_fds, &max_fd); |
| 77 } | 77 } |
| 78 | 78 |
| 79 const int notifier_fds[] = { | 79 const int notifier_fds[] = { |
| 80 wakeup_notifier_.receiver_fd(), | 80 wakeup_notifier_.receiver_fd(), |
| 81 deletion_notifier_.receiver_fd(), | 81 deletion_notifier_.receiver_fd(), |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 for (int i = 0; i < arraysize(notifier_fds); ++i) { | 84 for (size_t i = 0; i < arraysize(notifier_fds); ++i) { |
| 85 const int notifier_fd = notifier_fds[i]; | 85 const int notifier_fd = notifier_fds[i]; |
| 86 DCHECK_GT(notifier_fd, -1); | 86 DCHECK_GT(notifier_fd, -1); |
| 87 FD_SET(notifier_fd, &read_fds); | 87 FD_SET(notifier_fd, &read_fds); |
| 88 max_fd = std::max(max_fd, notifier_fd); | 88 max_fd = std::max(max_fd, notifier_fd); |
| 89 } | 89 } |
| 90 | 90 |
| 91 const int ret = HANDLE_EINTR( | 91 const int ret = HANDLE_EINTR( |
| 92 select(max_fd + 1, &read_fds, &write_fds, NULL, NULL)); | 92 select(max_fd + 1, &read_fds, &write_fds, NULL, NULL)); |
| 93 if (ret < 0) { | 93 if (ret < 0) { |
| 94 PLOG(ERROR) << "select"; | 94 PLOG(ERROR) << "select"; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 123 ++i; | 123 ++i; |
| 124 continue; | 124 continue; |
| 125 } | 125 } |
| 126 | 126 |
| 127 std::swap(forwarders_[i], forwarders_.back()); | 127 std::swap(forwarders_[i], forwarders_.back()); |
| 128 forwarders_.pop_back(); | 128 forwarders_.pop_back(); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace forwarder2 | 132 } // namespace forwarder2 |
| OLD | NEW |