| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 ColdModeSpellCheckRequester_h | 5 #ifndef ColdModeSpellCheckRequester_h |
| 6 #define ColdModeSpellCheckRequester_h | 6 #define ColdModeSpellCheckRequester_h |
| 7 | 7 |
| 8 #include "core/editing/EphemeralRange.h" | 8 #include "core/editing/EphemeralRange.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class IdleDeadline; | 13 class IdleDeadline; |
| 14 class SpellCheckRequester; | 14 class SpellCheckRequester; |
| 15 | 15 |
| 16 // This class is only supposed to be used by IdleSpellCheckCallback in cold mode | 16 // This class is only supposed to be used by IdleSpellCheckCallback in cold mode |
| 17 // invocation. Not to be confused with SpellCheckRequester. | 17 // invocation. Not to be confused with SpellCheckRequester. |
| 18 class ColdModeSpellCheckRequester | 18 class ColdModeSpellCheckRequester |
| 19 : public GarbageCollectedFinalized<ColdModeSpellCheckRequester> { | 19 : public GarbageCollected<ColdModeSpellCheckRequester> { |
| 20 public: | 20 public: |
| 21 static ColdModeSpellCheckRequester* create(LocalFrame&); | 21 static ColdModeSpellCheckRequester* create(LocalFrame&); |
| 22 ~ColdModeSpellCheckRequester(); | |
| 23 | 22 |
| 24 void setNeedsMoreInvocationForTesting() { | 23 void setNeedsMoreInvocationForTesting() { |
| 25 m_needsMoreInvocationForTesting = true; | 24 m_needsMoreInvocationForTesting = true; |
| 26 } | 25 } |
| 27 | 26 |
| 28 void invoke(IdleDeadline*); | 27 void invoke(IdleDeadline*); |
| 29 bool fullDocumentChecked() const; | 28 bool fullDocumentChecked() const; |
| 30 | 29 |
| 30 DECLARE_TRACE(); |
| 31 |
| 31 private: | 32 private: |
| 32 explicit ColdModeSpellCheckRequester(LocalFrame&); | 33 explicit ColdModeSpellCheckRequester(LocalFrame&); |
| 33 | 34 |
| 34 LocalFrame& frame() const { return *m_frame; } | 35 LocalFrame& frame() const { return *m_frame; } |
| 35 SpellCheckRequester& spellCheckRequester() const; | 36 SpellCheckRequester& spellCheckRequester() const; |
| 36 | 37 |
| 37 // Perform checking task incrementally based on the stored state. | 38 // Perform checking task incrementally based on the stored state. |
| 38 void step(); | 39 void step(); |
| 39 | 40 |
| 40 void searchForNextRootEditable(); | 41 void searchForNextRootEditable(); |
| 41 void initializeForCurrentRootEditable(); | 42 void initializeForCurrentRootEditable(); |
| 42 bool haveMoreChunksToCheck(); | 43 bool haveMoreChunksToCheck(); |
| 43 void requestCheckingForNextChunk(); | 44 void requestCheckingForNextChunk(); |
| 44 void finishCheckingCurrentRootEditable(); | 45 void finishCheckingCurrentRootEditable(); |
| 45 | 46 |
| 46 void resetCheckingProgress(); | 47 void resetCheckingProgress(); |
| 47 void chunkAndRequestFullCheckingFor(const Element&); | 48 void chunkAndRequestFullCheckingFor(const Element&); |
| 48 | 49 |
| 49 const Member<LocalFrame> m_frame; | 50 const Member<LocalFrame> m_frame; |
| 50 Member<Node> m_nextNode; | 51 Member<Node> m_nextNode; |
| 51 Member<Element> m_currentRootEditable; | 52 Member<Element> m_currentRootEditable; |
| 52 int m_currentFullLength; | 53 int m_currentFullLength; |
| 53 int m_currentChunkIndex; | 54 int m_currentChunkIndex; |
| 54 Position m_currentChunkStart; | 55 Position m_currentChunkStart; |
| 55 uint64_t m_lastCheckedDOMTreeVersion; | 56 uint64_t m_lastCheckedDOMTreeVersion; |
| 56 mutable bool m_needsMoreInvocationForTesting; | 57 mutable bool m_needsMoreInvocationForTesting; |
| 57 | 58 |
| 58 DECLARE_TRACE(); | |
| 59 DISALLOW_COPY_AND_ASSIGN(ColdModeSpellCheckRequester); | 59 DISALLOW_COPY_AND_ASSIGN(ColdModeSpellCheckRequester); |
| 60 }; | 60 }; |
| 61 } | 61 } |
| 62 | 62 |
| 63 #endif | 63 #endif |
| OLD | NEW |