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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 Stop(); | 55 Stop(); |
56 } | 56 } |
57 | 57 |
58 void SuspendableTimer::Suspend() { | 58 void SuspendableTimer::Suspend() { |
59 #if DCHECK_IS_ON() | 59 #if DCHECK_IS_ON() |
60 DCHECK(!suspended_); | 60 DCHECK(!suspended_); |
61 suspended_ = true; | 61 suspended_ = true; |
62 #endif | 62 #endif |
63 if (IsActive()) { | 63 if (IsActive()) { |
64 next_fire_interval_ = NextFireInterval(); | 64 next_fire_interval_ = NextFireInterval(); |
65 ASSERT(next_fire_interval_ >= 0.0); | 65 DCHECK_GE(next_fire_interval_, 0.0); |
66 repeat_interval_ = RepeatInterval(); | 66 repeat_interval_ = RepeatInterval(); |
67 TimerBase::Stop(); | 67 TimerBase::Stop(); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void SuspendableTimer::Resume() { | 71 void SuspendableTimer::Resume() { |
72 #if DCHECK_IS_ON() | 72 #if DCHECK_IS_ON() |
73 DCHECK(suspended_); | 73 DCHECK(suspended_); |
74 suspended_ = false; | 74 suspended_ = false; |
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 |