OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ScriptedIdleTaskController_h | 5 #ifndef ScriptedIdleTaskController_h |
6 #define ScriptedIdleTaskController_h | 6 #define ScriptedIdleTaskController_h |
7 | 7 |
8 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
9 #include "core/dom/IdleCallbackDeadline.h" | 9 #include "core/dom/IdleDeadline.h" |
10 #include "platform/Timer.h" | 10 #include "platform/Timer.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/RefCounted.h" | 12 #include "wtf/RefCounted.h" |
13 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class ExecutionContext; | 18 class ExecutionContext; |
19 class IdleRequestCallback; | 19 class IdleRequestCallback; |
(...skipping 13 matching lines...) Expand all Loading... |
33 | 33 |
34 int registerCallback(IdleRequestCallback*, double timeoutMillis); | 34 int registerCallback(IdleRequestCallback*, double timeoutMillis); |
35 void cancelCallback(CallbackId); | 35 void cancelCallback(CallbackId); |
36 | 36 |
37 // ActiveDOMObject interface. | 37 // ActiveDOMObject interface. |
38 void stop() override; | 38 void stop() override; |
39 void suspend() override; | 39 void suspend() override; |
40 void resume() override; | 40 void resume() override; |
41 bool hasPendingActivity() const override; | 41 bool hasPendingActivity() const override; |
42 | 42 |
43 void callbackFired(CallbackId, double deadlineSeconds, IdleCallbackDeadline:
:CallbackType); | 43 void callbackFired(CallbackId, double deadlineSeconds, IdleDeadline::Callbac
kType); |
44 | 44 |
45 private: | 45 private: |
46 explicit ScriptedIdleTaskController(ExecutionContext*); | 46 explicit ScriptedIdleTaskController(ExecutionContext*); |
47 | 47 |
48 void runCallback(CallbackId, double deadlineSeconds, IdleCallbackDeadline::C
allbackType); | 48 void runCallback(CallbackId, double deadlineSeconds, IdleDeadline::CallbackT
ype); |
49 | 49 |
50 WebScheduler* m_scheduler; // Not owned. | 50 WebScheduler* m_scheduler; // Not owned. |
51 PersistentHeapHashMapWillBeHeapHashMap<CallbackId, Member<IdleRequestCallbac
k>> m_callbacks; | 51 PersistentHeapHashMapWillBeHeapHashMap<CallbackId, Member<IdleRequestCallbac
k>> m_callbacks; |
52 Vector<CallbackId> m_pendingTimeouts; | 52 Vector<CallbackId> m_pendingTimeouts; |
53 CallbackId m_nextCallbackId; | 53 CallbackId m_nextCallbackId; |
54 bool m_suspended; | 54 bool m_suspended; |
55 }; | 55 }; |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
58 | 58 |
59 #endif // ScriptedIdleTaskController_h | 59 #endif // ScriptedIdleTaskController_h |
OLD | NEW |