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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 673 } |
674 | 674 |
675 void EpollServer::CallReadyListCallbacks() { | 675 void EpollServer::CallReadyListCallbacks() { |
676 // Check pre-conditions. | 676 // Check pre-conditions. |
677 DCHECK(tmp_list_.lh_first == NULL); | 677 DCHECK(tmp_list_.lh_first == NULL); |
678 // Swap out the ready_list_ into the tmp_list_ before traversing the list to | 678 // Swap out the ready_list_ into the tmp_list_ before traversing the list to |
679 // enable SetFDReady() to just push new items into the ready_list_. | 679 // enable SetFDReady() to just push new items into the ready_list_. |
680 std::swap(ready_list_.lh_first, tmp_list_.lh_first); | 680 std::swap(ready_list_.lh_first, tmp_list_.lh_first); |
681 if (tmp_list_.lh_first) { | 681 if (tmp_list_.lh_first) { |
682 tmp_list_.lh_first->entry.le_prev = &tmp_list_.lh_first; | 682 tmp_list_.lh_first->entry.le_prev = &tmp_list_.lh_first; |
683 EpollEvent event(0, false); | 683 EpollEvent event(0); |
684 while (tmp_list_.lh_first != NULL) { | 684 while (tmp_list_.lh_first != NULL) { |
685 DCHECK_GT(ready_list_size_, 0); | 685 DCHECK_GT(ready_list_size_, 0); |
686 CBAndEventMask* cb_and_mask = tmp_list_.lh_first; | 686 CBAndEventMask* cb_and_mask = tmp_list_.lh_first; |
687 RemoveFromReadyList(*cb_and_mask); | 687 RemoveFromReadyList(*cb_and_mask); |
688 | 688 |
689 event.out_ready_mask = 0; | 689 event.out_ready_mask = 0; |
690 event.in_events = | 690 event.in_events = |
691 cb_and_mask->events_asserted | cb_and_mask->events_to_fake; | 691 cb_and_mask->events_asserted | cb_and_mask->events_to_fake; |
692 // TODO(fenix): get rid of the two separate fields in cb_and_mask. | 692 // TODO(fenix): get rid of the two separate fields in cb_and_mask. |
693 cb_and_mask->events_asserted = 0; | 693 cb_and_mask->events_asserted = 0; |
(...skipping 101 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 |