Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/ColdModeSpellCheckRequester.h

Issue 2768393003: Use finer-grained checking in cold mode (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
9 10
10 namespace blink { 11 namespace blink {
11 12
12 class Element;
13 class IdleDeadline; 13 class IdleDeadline;
14 class LocalFrame;
15 class Node;
16 class SpellCheckRequester; 14 class SpellCheckRequester;
17 15
18 // 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
19 // invocation. Not to be confused with SpellCheckRequester. 17 // invocation. Not to be confused with SpellCheckRequester.
20 class ColdModeSpellCheckRequester 18 class ColdModeSpellCheckRequester
21 : public GarbageCollectedFinalized<ColdModeSpellCheckRequester> { 19 : public GarbageCollectedFinalized<ColdModeSpellCheckRequester> {
22 public: 20 public:
23 static ColdModeSpellCheckRequester* create(LocalFrame&); 21 static ColdModeSpellCheckRequester* create(LocalFrame&);
24 ~ColdModeSpellCheckRequester(); 22 ~ColdModeSpellCheckRequester();
25 23
26 void setNeedsMoreInvocationForTesting() { 24 void setNeedsMoreInvocationForTesting() {
27 m_needsMoreInvocationForTesting = true; 25 m_needsMoreInvocationForTesting = true;
28 } 26 }
29 27
30 void invoke(IdleDeadline*); 28 void invoke(IdleDeadline*);
31 bool fullDocumentChecked() const; 29 bool fullDocumentChecked() const;
32 30
33 private: 31 private:
34 explicit ColdModeSpellCheckRequester(LocalFrame&); 32 explicit ColdModeSpellCheckRequester(LocalFrame&);
35 33
36 LocalFrame& frame() const { return *m_frame; } 34 LocalFrame& frame() const { return *m_frame; }
37 SpellCheckRequester& spellCheckRequester() const; 35 SpellCheckRequester& spellCheckRequester() const;
38 36
37 // Perform checking task incrementally based on the stored state.
38 void step();
39
40 void searchForNextRootEditable();
41 void initializeForCurrentRootEditable();
42 bool haveMoreChunksToCheck();
43 void requestCheckingForNextChunk();
44 void finishCheckingCurrentRootEditable();
45
46 void resetCheckingProgress();
39 void chunkAndRequestFullCheckingFor(const Element&); 47 void chunkAndRequestFullCheckingFor(const Element&);
40 48
41 const Member<LocalFrame> m_frame; 49 const Member<LocalFrame> m_frame;
42 Member<Node> m_nextNode; 50 Member<Node> m_nextNode;
51 Member<Element> m_currentRootEditable;
52 int m_currentFullLength;
53 int m_currentChunkIndex;
54 Position m_currentChunkStart;
43 uint64_t m_lastCheckedDOMTreeVersion; 55 uint64_t m_lastCheckedDOMTreeVersion;
44 mutable bool m_needsMoreInvocationForTesting; 56 mutable bool m_needsMoreInvocationForTesting;
45 57
46 DECLARE_TRACE(); 58 DECLARE_TRACE();
47 DISALLOW_COPY_AND_ASSIGN(ColdModeSpellCheckRequester); 59 DISALLOW_COPY_AND_ASSIGN(ColdModeSpellCheckRequester);
48 }; 60 };
49 } 61 }
50 62
51 #endif 63 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698