OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class LocalFrame; | 41 class LocalFrame; |
42 class Node; | 42 class Node; |
43 class SpellCheckRequester; | 43 class SpellCheckRequester; |
44 class TextCheckerClient; | 44 class TextCheckerClient; |
45 | 45 |
46 class SpellCheckRequest FINAL : public TextCheckingRequest { | 46 class SpellCheckRequest FINAL : public TextCheckingRequest { |
47 public: | 47 public: |
48 static PassRefPtr<SpellCheckRequest> create(TextCheckingTypeMask, TextChecki
ngProcessType, PassRefPtrWillBeRawPtr<Range> checkingRange, PassRefPtrWillBeRawP
tr<Range> paragraphRange, int requestNumber = 0); | 48 static PassRefPtrWillBeRawPtr<SpellCheckRequest> create(TextCheckingTypeMask
, TextCheckingProcessType, PassRefPtrWillBeRawPtr<Range> checkingRange, PassRefP
trWillBeRawPtr<Range> paragraphRange, int requestNumber = 0); |
49 virtual ~SpellCheckRequest(); | 49 virtual ~SpellCheckRequest(); |
50 | 50 |
51 PassRefPtrWillBeRawPtr<Range> checkingRange() const { return m_checkingRange
; } | 51 PassRefPtrWillBeRawPtr<Range> checkingRange() const { return m_checkingRange
; } |
52 PassRefPtrWillBeRawPtr<Range> paragraphRange() const { return m_paragraphRan
ge; } | 52 PassRefPtrWillBeRawPtr<Range> paragraphRange() const { return m_paragraphRan
ge; } |
53 PassRefPtrWillBeRawPtr<Element> rootEditableElement() const { return m_rootE
ditableElement; } | 53 PassRefPtrWillBeRawPtr<Element> rootEditableElement() const { return m_rootE
ditableElement; } |
54 | 54 |
55 void setCheckerAndSequence(SpellCheckRequester*, int sequence); | 55 void setCheckerAndSequence(SpellCheckRequester*, int sequence); |
| 56 #if !ENABLE(OILPAN) |
56 void requesterDestroyed(); | 57 void requesterDestroyed(); |
| 58 #endif |
57 | 59 |
58 virtual const TextCheckingRequestData& data() const OVERRIDE; | 60 virtual const TextCheckingRequestData& data() const OVERRIDE; |
59 virtual void didSucceed(const Vector<TextCheckingResult>&) OVERRIDE; | 61 virtual void didSucceed(const Vector<TextCheckingResult>&) OVERRIDE; |
60 virtual void didCancel() OVERRIDE; | 62 virtual void didCancel() OVERRIDE; |
61 | 63 |
62 int requestNumber() const { return m_requestNumber; } | 64 int requestNumber() const { return m_requestNumber; } |
63 | 65 |
| 66 virtual void trace(Visitor*) OVERRIDE; |
| 67 |
64 private: | 68 private: |
65 SpellCheckRequest(PassRefPtrWillBeRawPtr<Range> checkingRange, PassRefPtrWil
lBeRawPtr<Range> paragraphRange, const String&, TextCheckingTypeMask, TextChecki
ngProcessType, const Vector<uint32_t>& documentMarkersInRange, const Vector<unsi
gned>& documentMarkerOffsets, int requestNumber); | 69 SpellCheckRequest(PassRefPtrWillBeRawPtr<Range> checkingRange, PassRefPtrWil
lBeRawPtr<Range> paragraphRange, const String&, TextCheckingTypeMask, TextChecki
ngProcessType, const Vector<uint32_t>& documentMarkersInRange, const Vector<unsi
gned>& documentMarkerOffsets, int requestNumber); |
66 | 70 |
67 SpellCheckRequester* m_requester; | 71 RawPtrWillBeMember<SpellCheckRequester> m_requester; |
68 RefPtrWillBePersistent<Range> m_checkingRange; | 72 RefPtrWillBeMember<Range> m_checkingRange; |
69 RefPtrWillBePersistent<Range> m_paragraphRange; | 73 RefPtrWillBeMember<Range> m_paragraphRange; |
70 RefPtrWillBePersistent<Element> m_rootEditableElement; | 74 RefPtrWillBeMember<Element> m_rootEditableElement; |
71 TextCheckingRequestData m_requestData; | 75 TextCheckingRequestData m_requestData; |
72 int m_requestNumber; | 76 int m_requestNumber; |
73 }; | 77 }; |
74 | 78 |
75 class SpellCheckRequester { | 79 class SpellCheckRequester FINAL : public NoBaseWillBeGarbageCollectedFinalized<S
pellCheckRequester> { |
76 WTF_MAKE_NONCOPYABLE(SpellCheckRequester); WTF_MAKE_FAST_ALLOCATED; | 80 WTF_MAKE_NONCOPYABLE(SpellCheckRequester); WTF_MAKE_FAST_ALLOCATED_WILL_BE_R
EMOVED; |
77 public: | 81 public: |
78 friend class SpellCheckRequest; | 82 static PassOwnPtrWillBeRawPtr<SpellCheckRequester> create(LocalFrame& frame) |
| 83 { |
| 84 return adoptPtrWillBeNoop(new SpellCheckRequester(frame)); |
| 85 } |
79 | 86 |
80 explicit SpellCheckRequester(LocalFrame&); | |
81 ~SpellCheckRequester(); | 87 ~SpellCheckRequester(); |
| 88 void trace(Visitor*); |
82 | 89 |
83 bool isAsynchronousEnabled() const; | 90 bool isAsynchronousEnabled() const; |
84 bool isCheckable(Range*) const; | 91 bool isCheckable(Range*) const; |
85 | 92 |
86 void requestCheckingFor(PassRefPtr<SpellCheckRequest>); | 93 void requestCheckingFor(PassRefPtrWillBeRawPtr<SpellCheckRequest>); |
87 void cancelCheck(); | 94 void cancelCheck(); |
88 | 95 |
89 int lastRequestSequence() const | 96 int lastRequestSequence() const |
90 { | 97 { |
91 return m_lastRequestSequence; | 98 return m_lastRequestSequence; |
92 } | 99 } |
93 | 100 |
94 int lastProcessedSequence() const | 101 int lastProcessedSequence() const |
95 { | 102 { |
96 return m_lastProcessedSequence; | 103 return m_lastProcessedSequence; |
97 } | 104 } |
98 | 105 |
99 private: | 106 private: |
100 typedef Deque<RefPtr<SpellCheckRequest> > RequestQueue; | 107 friend class SpellCheckRequest; |
| 108 |
| 109 explicit SpellCheckRequester(LocalFrame&); |
101 | 110 |
102 bool canCheckAsynchronously(Range*) const; | 111 bool canCheckAsynchronously(Range*) const; |
103 TextCheckerClient& client() const; | 112 TextCheckerClient& client() const; |
104 void timerFiredToProcessQueuedRequest(Timer<SpellCheckRequester>*); | 113 void timerFiredToProcessQueuedRequest(Timer<SpellCheckRequester>*); |
105 void invokeRequest(PassRefPtr<SpellCheckRequest>); | 114 void invokeRequest(PassRefPtrWillBeRawPtr<SpellCheckRequest>); |
106 void enqueueRequest(PassRefPtr<SpellCheckRequest>); | 115 void enqueueRequest(PassRefPtrWillBeRawPtr<SpellCheckRequest>); |
107 void didCheckSucceed(int sequence, const Vector<TextCheckingResult>&); | 116 void didCheckSucceed(int sequence, const Vector<TextCheckingResult>&); |
108 void didCheckCancel(int sequence); | 117 void didCheckCancel(int sequence); |
109 void didCheck(int sequence, const Vector<TextCheckingResult>&); | 118 void didCheck(int sequence, const Vector<TextCheckingResult>&); |
110 | 119 |
111 LocalFrame& m_frame; | 120 RawPtrWillBeMember<LocalFrame> m_frame; |
| 121 LocalFrame& frame() const { ASSERT(m_frame); return *m_frame; } |
| 122 |
112 int m_lastRequestSequence; | 123 int m_lastRequestSequence; |
113 int m_lastProcessedSequence; | 124 int m_lastProcessedSequence; |
114 | 125 |
115 Timer<SpellCheckRequester> m_timerToProcessQueuedRequest; | 126 Timer<SpellCheckRequester> m_timerToProcessQueuedRequest; |
116 | 127 |
117 RefPtr<SpellCheckRequest> m_processingRequest; | 128 RefPtrWillBeMember<SpellCheckRequest> m_processingRequest; |
| 129 |
| 130 typedef WillBeHeapDeque<RefPtrWillBeMember<SpellCheckRequest> > RequestQueue
; |
118 RequestQueue m_requestQueue; | 131 RequestQueue m_requestQueue; |
119 }; | 132 }; |
120 | 133 |
121 } // namespace blink | 134 } // namespace blink |
122 | 135 |
123 #endif // SpellCheckRequester_h | 136 #endif // SpellCheckRequester_h |
OLD | NEW |