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 17 matching lines...) Expand all Loading... |
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 } |
37 | 37 |
38 SuspendableTimer::SuspendableTimer(ExecutionContext* context) | 38 SuspendableTimer::SuspendableTimer(ExecutionContext* context, TaskType taskType) |
39 : TimerBase(TaskRunnerHelper::get(TaskType::Timer, context)), | 39 : TimerBase(TaskRunnerHelper::get(taskType, context)), |
40 SuspendableObject(context), | 40 SuspendableObject(context), |
41 m_nextFireInterval(kNextFireIntervalInvalid), | 41 m_nextFireInterval(kNextFireIntervalInvalid), |
42 m_repeatInterval(0) | 42 m_repeatInterval(0) { |
43 { | |
44 DCHECK(context); | 43 DCHECK(context); |
45 } | 44 } |
46 | 45 |
47 SuspendableTimer::~SuspendableTimer() {} | 46 SuspendableTimer::~SuspendableTimer() {} |
48 | 47 |
49 void SuspendableTimer::stop() { | 48 void SuspendableTimer::stop() { |
50 m_nextFireInterval = kNextFireIntervalInvalid; | 49 m_nextFireInterval = kNextFireIntervalInvalid; |
51 TimerBase::stop(); | 50 TimerBase::stop(); |
52 } | 51 } |
53 | 52 |
(...skipping 21 matching lines...) Expand all Loading... |
75 #endif | 74 #endif |
76 if (m_nextFireInterval >= 0.0) { | 75 if (m_nextFireInterval >= 0.0) { |
77 // start() was called before, therefore location() is already set. | 76 // start() was called before, therefore location() is already set. |
78 // m_nextFireInterval is only set in suspend() if the Timer was active. | 77 // m_nextFireInterval is only set in suspend() if the Timer was active. |
79 start(m_nextFireInterval, m_repeatInterval, location()); | 78 start(m_nextFireInterval, m_repeatInterval, location()); |
80 m_nextFireInterval = kNextFireIntervalInvalid; | 79 m_nextFireInterval = kNextFireIntervalInvalid; |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 } // namespace blink | 83 } // namespace blink |
OLD | NEW |