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 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class ExecutionContext; | 40 class ExecutionContext; |
41 | 41 |
42 class DOMTimer final : public RefCountedWillBeGarbageCollectedFinalized<DOMTimer
>, public SuspendableTimer { | 42 class DOMTimer final : public RefCountedWillBeGarbageCollectedFinalized<DOMTimer
>, public SuspendableTimer { |
43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); | 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMTimer); |
44 public: | 44 public: |
45 // Creates a new timer owned by the ExecutionContext, starts it and returns
its ID. | 45 // Creates a new timer owned by the ExecutionContext, starts it and returns
its ID. |
46 static int install(ExecutionContext*, PassOwnPtr<ScheduledAction>, int timeo
ut, bool singleShot); | 46 static int install(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction
>, int timeout, bool singleShot); |
47 static void removeByID(ExecutionContext*, int timeoutID); | 47 static void removeByID(ExecutionContext*, int timeoutID); |
48 | 48 |
49 virtual ~DOMTimer(); | 49 virtual ~DOMTimer(); |
50 | 50 |
51 int timeoutID() const; | 51 int timeoutID() const; |
52 | 52 |
53 // ActiveDOMObject | 53 // ActiveDOMObject |
54 virtual void stop() override; | 54 virtual void stop() override; |
55 | 55 |
56 // The following are essentially constants. All intervals are in seconds. | 56 // The following are essentially constants. All intervals are in seconds. |
57 static double hiddenPageAlignmentInterval(); | 57 static double hiddenPageAlignmentInterval(); |
58 static double visiblePageAlignmentInterval(); | 58 static double visiblePageAlignmentInterval(); |
59 | 59 |
60 virtual void trace(Visitor*) override; | 60 virtual void trace(Visitor*) override; |
61 | 61 |
62 void dispose(); | 62 void dispose(); |
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
ssOwnPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID) | 67 static PassRefPtrWillBeRawPtr<DOMTimer> create(ExecutionContext* context, Pa
ssOwnPtrWillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot, int
timeoutID) |
68 { | 68 { |
69 return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleS
hot, timeoutID)); | 69 return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleS
hot, timeoutID)); |
70 } | 70 } |
71 | 71 |
72 DOMTimer(ExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool
singleShot, int timeoutID); | 72 DOMTimer(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction>, int int
erval, bool singleShot, int timeoutID); |
73 virtual void fired() override; | 73 virtual void fired() override; |
74 | 74 |
75 // Retuns timer fire time rounded to the next multiple of timer alignment in
terval. | 75 // Retuns timer fire time rounded to the next multiple of timer alignment in
terval. |
76 virtual double alignedFireTime(double) const override; | 76 virtual double alignedFireTime(double) const override; |
77 | 77 |
78 int m_timeoutID; | 78 int m_timeoutID; |
79 int m_nestingLevel; | 79 int m_nestingLevel; |
80 OwnPtr<ScheduledAction> m_action; | 80 OwnPtrWillBeMember<ScheduledAction> m_action; |
81 RefPtr<UserGestureToken> m_userGestureToken; | 81 RefPtr<UserGestureToken> m_userGestureToken; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
85 | 85 |
86 #endif // DOMTimer_h | 86 #endif // DOMTimer_h |
OLD | NEW |