OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TIMER_RTC_ALARM_H_ | 5 #ifndef COMPONENTS_TIMER_RTC_ALARM_H_ |
6 #define COMPONENTS_TIMER_RTC_ALARM_H_ | 6 #define COMPONENTS_TIMER_RTC_ALARM_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 bool Init(base::WeakPtr<AlarmTimer> timer) override; | 41 bool Init(base::WeakPtr<AlarmTimer> timer) override; |
42 void Stop() override; | 42 void Stop() override; |
43 void Reset(base::TimeDelta delay) override; | 43 void Reset(base::TimeDelta delay) override; |
44 | 44 |
45 // base::MessageLoopForIO::Watcher overrides. | 45 // base::MessageLoopForIO::Watcher overrides. |
46 void OnFileCanReadWithoutBlocking(int fd) override; | 46 void OnFileCanReadWithoutBlocking(int fd) override; |
47 void OnFileCanWriteWithoutBlocking(int fd) override; | 47 void OnFileCanWriteWithoutBlocking(int fd) override; |
48 | 48 |
49 protected: | 49 protected: |
50 // Needs to be protected because AlarmTimer::Delegate is a refcounted class. | 50 // Needs to be protected because AlarmTimer::Delegate is a refcounted class. |
51 virtual ~RtcAlarm(); | 51 ~RtcAlarm() override; |
52 | 52 |
53 private: | 53 private: |
54 // Actually performs the system calls to set up the timer. This must be | 54 // Actually performs the system calls to set up the timer. This must be |
55 // called on a MessageLoopForIO. | 55 // called on a MessageLoopForIO. |
56 void ResetImpl(base::TimeDelta delay, int event_id); | 56 void ResetImpl(base::TimeDelta delay, int event_id); |
57 | 57 |
58 // Callback that is run when the timer fires. Must be run on | 58 // Callback that is run when the timer fires. Must be run on |
59 // |origin_message_loop_|. | 59 // |origin_message_loop_|. |
60 void OnTimerFired(int event_id); | 60 void OnTimerFired(int event_id); |
61 | 61 |
(...skipping 24 matching lines...) Expand all Loading... |
86 // where the user resets the timer on the original thread, while the event is | 86 // where the user resets the timer on the original thread, while the event is |
87 // being fired on the IO thread at the same time. | 87 // being fired on the IO thread at the same time. |
88 int origin_event_id_; | 88 int origin_event_id_; |
89 int io_event_id_; | 89 int io_event_id_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(RtcAlarm); | 91 DISALLOW_COPY_AND_ASSIGN(RtcAlarm); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace timers | 94 } // namespace timers |
95 #endif // COMPONENTS_TIMER_RTC_ALARM_H_ | 95 #endif // COMPONENTS_TIMER_RTC_ALARM_H_ |
OLD | NEW |