OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #endif | 130 #endif |
131 | 131 |
132 double new_time = now + delay; | 132 double new_time = now + delay; |
133 | 133 |
134 if (next_fire_time_ != new_time) { | 134 if (next_fire_time_ != new_time) { |
135 next_fire_time_ = new_time; | 135 next_fire_time_ = new_time; |
136 | 136 |
137 // Cancel any previously posted task. | 137 // Cancel any previously posted task. |
138 weak_ptr_factory_.RevokeAll(); | 138 weak_ptr_factory_.RevokeAll(); |
139 | 139 |
140 double delay_ms = 1000.0 * delay; | 140 TimerTaskRunner()->ToSingleThreadTaskRunner()->PostDelayedTask( |
141 TimerTaskRunner()->PostDelayedTask( | |
142 location_, | 141 location_, |
143 base::Bind(&TimerBase::RunInternal, weak_ptr_factory_.CreateWeakPtr()), | 142 base::Bind(&TimerBase::RunInternal, weak_ptr_factory_.CreateWeakPtr()), |
144 delay_ms); | 143 WTF::TimeDelta::FromSecondsD(delay)); |
145 } | 144 } |
146 } | 145 } |
147 | 146 |
148 NO_SANITIZE_ADDRESS | 147 NO_SANITIZE_ADDRESS |
149 void TimerBase::RunInternal() { | 148 void TimerBase::RunInternal() { |
150 if (!CanFire()) | 149 if (!CanFire()) |
151 return; | 150 return; |
152 | 151 |
153 weak_ptr_factory_.RevokeAll(); | 152 weak_ptr_factory_.RevokeAll(); |
154 | 153 |
(...skipping 24 matching lines...) Expand all Loading... |
179 const TimerBase* b) const { | 178 const TimerBase* b) const { |
180 return a->next_fire_time_ < b->next_fire_time_; | 179 return a->next_fire_time_ < b->next_fire_time_; |
181 } | 180 } |
182 | 181 |
183 // static | 182 // static |
184 double TimerBase::TimerMonotonicallyIncreasingTime() const { | 183 double TimerBase::TimerMonotonicallyIncreasingTime() const { |
185 return TimerTaskRunner()->MonotonicallyIncreasingVirtualTimeSeconds(); | 184 return TimerTaskRunner()->MonotonicallyIncreasingVirtualTimeSeconds(); |
186 } | 185 } |
187 | 186 |
188 } // namespace blink | 187 } // namespace blink |
OLD | NEW |