| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class ExecutionContext; | 39 class ExecutionContext; |
| 40 | 40 |
| 41 class CORE_EXPORT DOMTimer final : public GarbageCollectedFinalized<DOMTimer>, | 41 class CORE_EXPORT DOMTimer final : public GarbageCollectedFinalized<DOMTimer>, |
| 42 public SuspendableTimer { | 42 public SuspendableTimer { |
| 43 USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); | 43 USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); |
| 44 | 44 |
| 45 public: | 45 public: |
| 46 // Creates a new timer owned by the ExecutionContext, starts it and returns it
s ID. | 46 // Creates a new timer owned by the ExecutionContext, starts it and returns |
| 47 // its ID. |
| 47 static int install(ExecutionContext*, | 48 static int install(ExecutionContext*, |
| 48 ScheduledAction*, | 49 ScheduledAction*, |
| 49 int timeout, | 50 int timeout, |
| 50 bool singleShot); | 51 bool singleShot); |
| 51 static void removeByID(ExecutionContext*, int timeoutID); | 52 static void removeByID(ExecutionContext*, int timeoutID); |
| 52 | 53 |
| 53 ~DOMTimer() override; | 54 ~DOMTimer() override; |
| 54 | 55 |
| 55 // ActiveDOMObject | 56 // ActiveDOMObject |
| 56 void contextDestroyed() override; | 57 void contextDestroyed() override; |
| 57 | 58 |
| 58 // Eager finalization is needed to promptly stop this Timer object. | 59 // Eager finalization is needed to promptly stop this Timer object. |
| 59 // Otherwise timer events might fire at an object that's slated for destructio
n | 60 // Otherwise timer events might fire at an object that's slated for |
| 60 // (when lazily swept), but some of its members (m_action) may already have | 61 // destruction (when lazily swept), but some of its members (m_action) may |
| 61 // been finalized & must not be accessed. | 62 // already have been finalized & must not be accessed. |
| 62 EAGERLY_FINALIZE(); | 63 EAGERLY_FINALIZE(); |
| 63 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
| 64 | 65 |
| 65 void stop() override; | 66 void stop() override; |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 friend class DOMTimerCoordinator; // For create(). | 69 friend class DOMTimerCoordinator; // For create(). |
| 69 | 70 |
| 70 static DOMTimer* create(ExecutionContext* context, | 71 static DOMTimer* create(ExecutionContext* context, |
| 71 ScheduledAction* action, | 72 ScheduledAction* action, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 86 | 87 |
| 87 int m_timeoutID; | 88 int m_timeoutID; |
| 88 int m_nestingLevel; | 89 int m_nestingLevel; |
| 89 Member<ScheduledAction> m_action; | 90 Member<ScheduledAction> m_action; |
| 90 RefPtr<UserGestureToken> m_userGestureToken; | 91 RefPtr<UserGestureToken> m_userGestureToken; |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| 94 | 95 |
| 95 #endif // DOMTimer_h | 96 #endif // DOMTimer_h |
| OLD | NEW |