OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 IdleSpellCheckCallback_h | 5 #ifndef IdleSpellCheckCallback_h |
6 #define IdleSpellCheckCallback_h | 6 #define IdleSpellCheckCallback_h |
7 | 7 |
8 #include "core/dom/IdleRequestCallback.h" | 8 #include "core/dom/IdleRequestCallback.h" |
9 #include "core/dom/SynchronousMutationObserver.h" | 9 #include "core/dom/SynchronousMutationObserver.h" |
10 #include "core/editing/EphemeralRange.h" | 10 #include "core/editing/EphemeralRange.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 private: | 67 private: |
68 explicit IdleSpellCheckCallback(LocalFrame&); | 68 explicit IdleSpellCheckCallback(LocalFrame&); |
69 void handleEvent(IdleDeadline*) override; | 69 void handleEvent(IdleDeadline*) override; |
70 | 70 |
71 LocalFrame& frame() const { return *m_frame; } | 71 LocalFrame& frame() const { return *m_frame; } |
72 | 72 |
73 // Returns whether spell checking is globally enabled. | 73 // Returns whether spell checking is globally enabled. |
74 bool isSpellCheckingEnabled() const; | 74 bool isSpellCheckingEnabled() const; |
75 | 75 |
76 // Calls requestIdleCallback with this IdleSpellCheckCallback. | |
77 void requestInvocation(); | |
78 | |
79 // Functions for hot mode. | 76 // Functions for hot mode. |
80 void hotModeInvocation(IdleDeadline*); | 77 void hotModeInvocation(IdleDeadline*); |
81 | 78 |
82 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests | 79 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests |
83 // cold mode invocation if no critical operation occurs before timer firing. | 80 // cold mode invocation if no critical operation occurs before timer firing. |
84 void setNeedsColdModeInvocation(); | 81 void setNeedsColdModeInvocation(); |
85 | 82 |
86 // Functions for cold mode. | 83 // Functions for cold mode. |
87 void coldModeTimerFired(TimerBase*); | 84 void coldModeTimerFired(TimerBase*); |
88 void coldModeInvocation(IdleDeadline*); | 85 void coldModeInvocation(IdleDeadline*); |
89 bool coldModeFinishesFullDocument() const; | 86 bool coldModeFinishesFullDocument() const; |
90 | 87 |
91 // Implements |SynchronousMutationObserver|. | 88 // Implements |SynchronousMutationObserver|. |
92 void contextDestroyed(Document*) final; | 89 void contextDestroyed(Document*) final; |
93 | 90 |
94 State m_state; | 91 State m_state; |
95 int m_idleCallbackHandle; | 92 int m_idleCallbackHandle; |
96 mutable bool m_needsMoreColdModeInvocationForTesting; | 93 mutable bool m_needsMoreColdModeInvocationForTesting; |
97 const Member<LocalFrame> m_frame; | 94 const Member<LocalFrame> m_frame; |
98 uint64_t m_lastProcessedUndoStepSequence; | 95 uint64_t m_lastProcessedUndoStepSequence; |
99 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; | 96 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; |
100 }; | 97 }; |
101 | 98 |
102 } // namespace blink | 99 } // namespace blink |
103 | 100 |
104 #endif // IdleSpellCheckCallback_h | 101 #endif // IdleSpellCheckCallback_h |
OLD | NEW |