| 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 "platform/Timer.h" | 9 #include "platform/Timer.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void setNeedsColdModeInvocation(); | 30 void setNeedsColdModeInvocation(); |
| 31 | 31 |
| 32 // Cleans everything up and makes the callback inactive. Should be called when | 32 // Cleans everything up and makes the callback inactive. Should be called when |
| 33 // document is detached or spellchecking is globally disabled. | 33 // document is detached or spellchecking is globally disabled. |
| 34 // TODO(xiaochengh): Add proper call sites. | 34 // TODO(xiaochengh): Add proper call sites. |
| 35 void deactivate(); | 35 void deactivate(); |
| 36 | 36 |
| 37 // Exposed for testing only. | 37 // Exposed for testing only. |
| 38 SpellCheckRequester& spellCheckRequester() const; | 38 SpellCheckRequester& spellCheckRequester() const; |
| 39 | 39 |
| 40 // The leak detector will report leaks should queued requests be posted | |
| 41 // while it GCs repeatedly, as the requests keep their associated element | |
| 42 // alive. | |
| 43 // | |
| 44 // Hence allow the leak detector to effectively stop the spell checker to | |
| 45 // ensure leak reporting stability. | |
| 46 void prepareForLeakDetection(); | |
| 47 | |
| 48 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
| 49 | 41 |
| 50 private: | 42 private: |
| 51 explicit IdleSpellCheckCallback(LocalFrame&); | 43 explicit IdleSpellCheckCallback(LocalFrame&); |
| 52 void handleEvent(IdleDeadline*) override; | 44 void handleEvent(IdleDeadline*) override; |
| 53 | 45 |
| 54 LocalFrame& frame() const { return *m_frame; } | 46 LocalFrame& frame() const { return *m_frame; } |
| 55 | 47 |
| 56 enum class State { | 48 enum class State { |
| 57 kInactive, | 49 kInactive, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 | 70 |
| 79 State m_state; | 71 State m_state; |
| 80 const Member<LocalFrame> m_frame; | 72 const Member<LocalFrame> m_frame; |
| 81 | 73 |
| 82 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; | 74 TaskRunnerTimer<IdleSpellCheckCallback> m_coldModeTimer; |
| 83 }; | 75 }; |
| 84 | 76 |
| 85 } // namespace blink | 77 } // namespace blink |
| 86 | 78 |
| 87 #endif // IdleSpellCheckCallback_h | 79 #endif // IdleSpellCheckCallback_h |
| OLD | NEW |