OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #include "core/frame/SuspendableTimer.h" | 27 #include "core/frame/SuspendableTimer.h" |
28 | 28 |
29 #include "core/dom/TaskRunnerHelper.h" | 29 #include "core/dom/TaskRunnerHelper.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 namespace { | 33 namespace { |
34 // The lowest value returned by TimerBase::nextUnalignedFireInterval is 0.0 | 34 // The lowest value returned by TimerBase::nextUnalignedFireInterval is 0.0 |
35 const double kNextFireIntervalInvalid = -1.0; | 35 const double kNextFireIntervalInvalid = -1.0; |
36 } | 36 } // namespace |
37 | 37 |
38 SuspendableTimer::SuspendableTimer(ExecutionContext* context, | 38 SuspendableTimer::SuspendableTimer(ExecutionContext* context, |
39 TaskType task_type) | 39 TaskType task_type) |
40 : TimerBase(TaskRunnerHelper::Get(task_type, context)), | 40 : TimerBase(TaskRunnerHelper::Get(task_type, context)), |
41 SuspendableObject(context), | 41 SuspendableObject(context), |
42 next_fire_interval_(kNextFireIntervalInvalid), | 42 next_fire_interval_(kNextFireIntervalInvalid), |
43 repeat_interval_(0) { | 43 repeat_interval_(0) { |
44 DCHECK(context); | 44 DCHECK(context); |
45 } | 45 } |
46 | 46 |
(...skipping 28 matching lines...) Expand all Loading... |
75 #endif | 75 #endif |
76 if (next_fire_interval_ >= 0.0) { | 76 if (next_fire_interval_ >= 0.0) { |
77 // start() was called before, therefore location() is already set. | 77 // start() was called before, therefore location() is already set. |
78 // m_nextFireInterval is only set in suspend() if the Timer was active. | 78 // m_nextFireInterval is only set in suspend() if the Timer was active. |
79 Start(next_fire_interval_, repeat_interval_, GetLocation()); | 79 Start(next_fire_interval_, repeat_interval_, GetLocation()); |
80 next_fire_interval_ = kNextFireIntervalInvalid; | 80 next_fire_interval_ = kNextFireIntervalInvalid; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |