| 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 "net/tools/epoll_server/epoll_server.h" | 5 #include "net/tools/epoll_server/epoll_server.h" |
| 6 | 6 |
| 7 #include <unistd.h> // For read, pipe, close and write. | 7 #include <unistd.h> // For read, pipe, close and write. |
| 8 #include <stdlib.h> // for abort | 8 #include <stdlib.h> // for abort |
| 9 #include <errno.h> // for errno and strerror_r | 9 #include <errno.h> // for errno and strerror_r |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 ++count; | 435 ++count; |
| 436 } | 436 } |
| 437 for (cur = tmp_list_.lh_first; cur; cur = cur->entry.le_next) { | 437 for (cur = tmp_list_.lh_first; cur; cur = cur->entry.le_next) { |
| 438 ++count; | 438 ++count; |
| 439 } | 439 } |
| 440 CHECK_EQ(ready_list_size_, count) << "Ready list size does not match count"; | 440 CHECK_EQ(ready_list_size_, count) << "Ready list size does not match count"; |
| 441 } | 441 } |
| 442 | 442 |
| 443 void EpollServer::RegisterAlarm(int64_t timeout_time_in_us, AlarmCB* ac) { | 443 void EpollServer::RegisterAlarm(int64_t timeout_time_in_us, AlarmCB* ac) { |
| 444 CHECK(ac); | 444 CHECK(ac); |
| 445 if (ContainsKey(all_alarms_, ac)) { | 445 if (base::ContainsKey(all_alarms_, ac)) { |
| 446 LOG(FATAL) << "Alarm already exists " << ac; | 446 LOG(FATAL) << "Alarm already exists " << ac; |
| 447 } | 447 } |
| 448 VLOG(4) << "RegisteringAlarm at : " << timeout_time_in_us; | 448 VLOG(4) << "RegisteringAlarm at : " << timeout_time_in_us; |
| 449 | 449 |
| 450 TimeToAlarmCBMap::iterator alarm_iter = | 450 TimeToAlarmCBMap::iterator alarm_iter = |
| 451 alarm_map_.insert(std::make_pair(timeout_time_in_us, ac)); | 451 alarm_map_.insert(std::make_pair(timeout_time_in_us, ac)); |
| 452 | 452 |
| 453 all_alarms_.insert(ac); | 453 all_alarms_.insert(ac); |
| 454 // Pass the iterator to the EpollAlarmCallbackInterface. | 454 // Pass the iterator to the EpollAlarmCallbackInterface. |
| 455 ac->OnRegistration(alarm_iter, this); | 455 ac->OnRegistration(alarm_iter, this); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 | 795 |
| 796 // If the alarm was registered, unregister it. | 796 // If the alarm was registered, unregister it. |
| 797 void EpollAlarm::UnregisterIfRegistered() { | 797 void EpollAlarm::UnregisterIfRegistered() { |
| 798 if (!registered_) { | 798 if (!registered_) { |
| 799 return; | 799 return; |
| 800 } | 800 } |
| 801 eps_->UnregisterAlarm(token_); | 801 eps_->UnregisterAlarm(token_); |
| 802 } | 802 } |
| 803 | 803 |
| 804 } // namespace net | 804 } // namespace net |
| OLD | NEW |