| 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_QUIC_QUIC_ALARM_H_ | 5 #ifndef NET_QUIC_QUIC_ALARM_H_ |
| 6 #define NET_QUIC_QUIC_ALARM_H_ | 6 #define NET_QUIC_QUIC_ALARM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 protected: | 56 protected: |
| 57 // Subclasses implement this method to perform the platform-specific | 57 // Subclasses implement this method to perform the platform-specific |
| 58 // scheduling of the alarm. Is called from Set() or Fire(), after the | 58 // scheduling of the alarm. Is called from Set() or Fire(), after the |
| 59 // deadline has been updated. | 59 // deadline has been updated. |
| 60 virtual void SetImpl() = 0; | 60 virtual void SetImpl() = 0; |
| 61 | 61 |
| 62 // Subclasses implement this method to perform the platform-specific | 62 // Subclasses implement this method to perform the platform-specific |
| 63 // cancelation of the alarm. | 63 // cancelation of the alarm. |
| 64 virtual void CancelImpl() = 0; | 64 virtual void CancelImpl() = 0; |
| 65 | 65 |
| 66 // Subclasses implement this method to perform the platform-specific update of |
| 67 // the alarm if there exists a more optimal implementation than calling |
| 68 // CancelImpl() and SetImpl(). |
| 69 virtual void UpdateImpl(); |
| 70 |
| 66 // Called by subclasses when the alarm fires. Invokes the | 71 // Called by subclasses when the alarm fires. Invokes the |
| 67 // delegates |OnAlarm| if a delegate is set, and if the deadline | 72 // delegates |OnAlarm| if a delegate is set, and if the deadline |
| 68 // has been exceeded. Implementations which do not remove the | 73 // has been exceeded. Implementations which do not remove the |
| 69 // alarm from the underlying scheduler on Cancel() may need to handle | 74 // alarm from the underlying scheduler on Cancel() may need to handle |
| 70 // the situation where the task executes before the deadline has been | 75 // the situation where the task executes before the deadline has been |
| 71 // reached, in which case they need to reschedule the task and must not | 76 // reached, in which case they need to reschedule the task and must not |
| 72 // call invoke this method. | 77 // call invoke this method. |
| 73 void Fire(); | 78 void Fire(); |
| 74 | 79 |
| 75 private: | 80 private: |
| 76 QuicArenaScopedPtr<Delegate> delegate_; | 81 QuicArenaScopedPtr<Delegate> delegate_; |
| 77 QuicTime deadline_; | 82 QuicTime deadline_; |
| 78 | 83 |
| 79 DISALLOW_COPY_AND_ASSIGN(QuicAlarm); | 84 DISALLOW_COPY_AND_ASSIGN(QuicAlarm); |
| 80 }; | 85 }; |
| 81 | 86 |
| 82 } // namespace net | 87 } // namespace net |
| 83 | 88 |
| 84 #endif // NET_QUIC_QUIC_ALARM_H_ | 89 #endif // NET_QUIC_QUIC_ALARM_H_ |
| OLD | NEW |