| 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 22 matching lines...) Expand all Loading... |
| 33 #include "platform/UserGestureIndicator.h" | 33 #include "platform/UserGestureIndicator.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class ExecutionContext; | 41 class ExecutionContext; |
| 42 | 42 |
| 43 class CORE_EXPORT DOMTimer final : public RefCountedWillBeGarbageCollectedFinali
zed<DOMTimer>, public SuspendableTimer { | 43 class CORE_EXPORT DOMTimer final : public GarbageCollectedFinalized<DOMTimer>, p
ublic SuspendableTimer { |
| 44 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); | 44 USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); |
| 45 public: | 45 public: |
| 46 // Creates a new timer owned by the ExecutionContext, starts it and returns
its ID. | 46 // Creates a new timer owned by the ExecutionContext, starts it and returns
its ID. |
| 47 static int install(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction
>, int timeout, bool singleShot); | 47 static int install(ExecutionContext*, RawPtr<ScheduledAction>, int timeout,
bool singleShot); |
| 48 static void removeByID(ExecutionContext*, int timeoutID); | 48 static void removeByID(ExecutionContext*, int timeoutID); |
| 49 | 49 |
| 50 ~DOMTimer() override; | 50 ~DOMTimer() override; |
| 51 | 51 |
| 52 // ActiveDOMObject | 52 // ActiveDOMObject |
| 53 void stop() override; | 53 void stop() override; |
| 54 | 54 |
| 55 // Eager finalization is needed to promptly stop this Timer object. | 55 // Eager finalization is needed to promptly stop this Timer object. |
| 56 // Otherwise timer events might fire at an object that's slated for destruct
ion | 56 // Otherwise timer events might fire at an object that's slated for destruct
ion |
| 57 // (when lazily swept), but some of its members (m_action) may already have | 57 // (when lazily swept), but some of its members (m_action) may already have |
| 58 // been finalized & must not be accessed. | 58 // been finalized & must not be accessed. |
| 59 EAGERLY_FINALIZE(); | 59 EAGERLY_FINALIZE(); |
| 60 DECLARE_VIRTUAL_TRACE(); | 60 DECLARE_VIRTUAL_TRACE(); |
| 61 | 61 |
| 62 void disposeTimer(); | 62 void disposeTimer(); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend class DOMTimerCoordinator; // For create(). | 65 friend class DOMTimerCoordinator; // For create(). |
| 66 | 66 |
| 67 static PassRefPtrWillBeRawPtr<DOMTimer> create(ExecutionContext* context, Pa
ssOwnPtrWillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot, int
timeoutID) | 67 static RawPtr<DOMTimer> create(ExecutionContext* context, RawPtr<ScheduledAc
tion> action, int timeout, bool singleShot, int timeoutID) |
| 68 { | 68 { |
| 69 return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleS
hot, timeoutID)); | 69 return new DOMTimer(context, action, timeout, singleShot, timeoutID); |
| 70 } | 70 } |
| 71 | 71 |
| 72 DOMTimer(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction>, int int
erval, bool singleShot, int timeoutID); | 72 DOMTimer(ExecutionContext*, RawPtr<ScheduledAction>, int interval, bool sing
leShot, int timeoutID); |
| 73 void fired() override; | 73 void fired() override; |
| 74 | 74 |
| 75 WebTaskRunner* timerTaskRunner() const override; | 75 WebTaskRunner* timerTaskRunner() const override; |
| 76 | 76 |
| 77 int m_timeoutID; | 77 int m_timeoutID; |
| 78 int m_nestingLevel; | 78 int m_nestingLevel; |
| 79 OwnPtrWillBeMember<ScheduledAction> m_action; | 79 Member<ScheduledAction> m_action; |
| 80 RefPtr<UserGestureToken> m_userGestureToken; | 80 RefPtr<UserGestureToken> m_userGestureToken; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| 84 | 84 |
| 85 #endif // DOMTimer_h | 85 #endif // DOMTimer_h |
| OLD | NEW |