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 // ActiveDOMObject | 51 // ActiveDOMObject |
52 virtual void stop() override; | 52 virtual void stop() override; |
53 | 53 |
54 // The following are essentially constants. All intervals are in seconds. | 54 // The following are essentially constants. All intervals are in seconds. |
55 static double hiddenPageAlignmentInterval(); | 55 static double hiddenPageAlignmentInterval(); |
56 static double visiblePageAlignmentInterval(); | 56 static double visiblePageAlignmentInterval(); |
57 | 57 |
58 virtual void trace(Visitor*) override; | 58 virtual void trace(Visitor*) override; |
59 | 59 |
60 void dispose(); | 60 void dispose(); |
61 | 61 |
62 private: | 62 private: |
63 friend class DOMTimerCoordinator; // For create(). | 63 friend class DOMTimerCoordinator; // For create(). |
64 | 64 |
65 static PassRefPtrWillBeRawPtr<DOMTimer> create(ExecutionContext* context, Pa
ssOwnPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID) | 65 static PassRefPtrWillBeRawPtr<DOMTimer> create(ExecutionContext* context, Pa
ssOwnPtrWillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot, int
timeoutID) |
66 { | 66 { |
67 return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleS
hot, timeoutID)); | 67 return adoptRefWillBeNoop(new DOMTimer(context, action, timeout, singleS
hot, timeoutID)); |
68 } | 68 } |
69 | 69 |
70 DOMTimer(ExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool
singleShot, int timeoutID); | 70 DOMTimer(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAction>, int int
erval, bool singleShot, int timeoutID); |
71 virtual void fired() override; | 71 virtual void fired() override; |
72 | 72 |
73 // Retuns timer fire time rounded to the next multiple of timer alignment in
terval. | 73 // Retuns timer fire time rounded to the next multiple of timer alignment in
terval. |
74 virtual double alignedFireTime(double) const override; | 74 virtual double alignedFireTime(double) const override; |
75 | 75 |
76 int m_timeoutID; | 76 int m_timeoutID; |
77 int m_nestingLevel; | 77 int m_nestingLevel; |
78 OwnPtr<ScheduledAction> m_action; | 78 OwnPtrWillBeMember<ScheduledAction> m_action; |
79 RefPtr<UserGestureToken> m_userGestureToken; | 79 RefPtr<UserGestureToken> m_userGestureToken; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
83 | 83 |
84 #endif // DOMTimer_h | 84 #endif // DOMTimer_h |
OLD | NEW |