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 #ifndef NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ | 5 #ifndef NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ |
6 #define NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ | 6 #define NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ |
7 | 7 |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/queue.h> | 9 #include <sys/queue.h> |
10 #include <map> | 10 #include <map> |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 // of the parent class, or is must otherwise make sure that the 'registered_' | 1016 // of the parent class, or is must otherwise make sure that the 'registered_' |
1017 // boolean and the token, 'token_', are updated appropriately. | 1017 // boolean and the token, 'token_', are updated appropriately. |
1018 class EpollAlarm : public EpollAlarmCallbackInterface { | 1018 class EpollAlarm : public EpollAlarmCallbackInterface { |
1019 public: | 1019 public: |
1020 EpollAlarm(); | 1020 EpollAlarm(); |
1021 | 1021 |
1022 virtual ~EpollAlarm(); | 1022 virtual ~EpollAlarm(); |
1023 | 1023 |
1024 // Marks the alarm as unregistered and returns 0. The return value may be | 1024 // Marks the alarm as unregistered and returns 0. The return value may be |
1025 // safely ignored by subclasses. | 1025 // safely ignored by subclasses. |
1026 virtual int64 OnAlarm() OVERRIDE; | 1026 virtual int64 OnAlarm() override; |
1027 | 1027 |
1028 // Marks the alarm as registered, and stores the token. | 1028 // Marks the alarm as registered, and stores the token. |
1029 virtual void OnRegistration(const EpollServer::AlarmRegToken& token, | 1029 virtual void OnRegistration(const EpollServer::AlarmRegToken& token, |
1030 EpollServer* eps) OVERRIDE; | 1030 EpollServer* eps) override; |
1031 | 1031 |
1032 // Marks the alarm as unregistered. | 1032 // Marks the alarm as unregistered. |
1033 virtual void OnUnregistration() OVERRIDE; | 1033 virtual void OnUnregistration() override; |
1034 | 1034 |
1035 // Marks the alarm as unregistered. | 1035 // Marks the alarm as unregistered. |
1036 virtual void OnShutdown(EpollServer* eps) OVERRIDE; | 1036 virtual void OnShutdown(EpollServer* eps) override; |
1037 | 1037 |
1038 // If the alarm was registered, unregister it. | 1038 // If the alarm was registered, unregister it. |
1039 void UnregisterIfRegistered(); | 1039 void UnregisterIfRegistered(); |
1040 | 1040 |
1041 bool registered() const { return registered_; } | 1041 bool registered() const { return registered_; } |
1042 | 1042 |
1043 const EpollServer* eps() const { return eps_; } | 1043 const EpollServer* eps() const { return eps_; } |
1044 | 1044 |
1045 private: | 1045 private: |
1046 EpollServer::AlarmRegToken token_; | 1046 EpollServer::AlarmRegToken token_; |
1047 EpollServer* eps_; | 1047 EpollServer* eps_; |
1048 bool registered_; | 1048 bool registered_; |
1049 }; | 1049 }; |
1050 | 1050 |
1051 } // namespace net | 1051 } // namespace net |
1052 | 1052 |
1053 #endif // NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ | 1053 #endif // NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ |
OLD | NEW |