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

Side by Side Diff: third_party/WebKit/Source/web/TextFinder.cpp

Issue 2645463002: Move TextFinder's deferred scoping work to the unspeced timer task queue (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/TextFinder.h" 31 #include "web/TextFinder.h"
32 32
33 #include "core/dom/Range.h" 33 #include "core/dom/Range.h"
34 #include "core/dom/TaskRunnerHelper.h"
34 #include "core/dom/shadow/ShadowRoot.h" 35 #include "core/dom/shadow/ShadowRoot.h"
35 #include "core/editing/Editor.h" 36 #include "core/editing/Editor.h"
36 #include "core/editing/VisibleSelection.h" 37 #include "core/editing/VisibleSelection.h"
37 #include "core/editing/iterators/SearchBuffer.h" 38 #include "core/editing/iterators/SearchBuffer.h"
38 #include "core/editing/markers/DocumentMarker.h" 39 #include "core/editing/markers/DocumentMarker.h"
39 #include "core/editing/markers/DocumentMarkerController.h" 40 #include "core/editing/markers/DocumentMarkerController.h"
40 #include "core/frame/FrameView.h" 41 #include "core/frame/FrameView.h"
41 #include "core/layout/LayoutObject.h" 42 #include "core/layout/LayoutObject.h"
42 #include "core/layout/TextAutosizer.h" 43 #include "core/layout/TextAutosizer.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 DEFINE_INLINE_TRACE() { visitor->trace(m_textFinder); } 79 DEFINE_INLINE_TRACE() { visitor->trace(m_textFinder); }
79 80
80 void dispose() { m_timer.stop(); } 81 void dispose() { m_timer.stop(); }
81 82
82 private: 83 private:
83 DeferredScopeStringMatches(TextFinder* textFinder, 84 DeferredScopeStringMatches(TextFinder* textFinder,
84 int identifier, 85 int identifier,
85 const WebString& searchText, 86 const WebString& searchText,
86 const WebFindOptions& options) 87 const WebFindOptions& options)
87 : m_timer(this, &DeferredScopeStringMatches::doTimeout), 88 : m_timer(TaskRunnerHelper::get(TaskType::UnspecedTimer,
89 textFinder->ownerFrame().frame()),
90 this,
91 &DeferredScopeStringMatches::doTimeout),
88 m_textFinder(textFinder), 92 m_textFinder(textFinder),
89 m_identifier(identifier), 93 m_identifier(identifier),
90 m_searchText(searchText), 94 m_searchText(searchText),
91 m_options(options) { 95 m_options(options) {
92 m_timer.startOneShot(0.0, BLINK_FROM_HERE); 96 m_timer.startOneShot(0.0, BLINK_FROM_HERE);
93 } 97 }
94 98
95 void doTimeout(TimerBase*) { 99 void doTimeout(TimerBase*) {
96 m_textFinder->resumeScopingStringMatches(m_identifier, m_searchText, 100 m_textFinder->resumeScopingStringMatches(m_identifier, m_searchText,
97 m_options); 101 m_options);
98 } 102 }
99 103
100 Timer<DeferredScopeStringMatches> m_timer; 104 TaskRunnerTimer<DeferredScopeStringMatches> m_timer;
101 Member<TextFinder> m_textFinder; 105 Member<TextFinder> m_textFinder;
102 const int m_identifier; 106 const int m_identifier;
103 const WebString m_searchText; 107 const WebString m_searchText;
104 const WebFindOptions m_options; 108 const WebFindOptions m_options;
105 }; 109 };
106 110
107 bool TextFinder::find(int identifier, 111 bool TextFinder::find(int identifier,
108 const WebString& searchText, 112 const WebString& searchText,
109 const WebFindOptions& options, 113 const WebFindOptions& options,
110 bool wrapWithinFrame, 114 bool wrapWithinFrame,
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 773
770 DEFINE_TRACE(TextFinder) { 774 DEFINE_TRACE(TextFinder) {
771 visitor->trace(m_ownerFrame); 775 visitor->trace(m_ownerFrame);
772 visitor->trace(m_activeMatch); 776 visitor->trace(m_activeMatch);
773 visitor->trace(m_resumeScopingFromRange); 777 visitor->trace(m_resumeScopingFromRange);
774 visitor->trace(m_deferredScopingWork); 778 visitor->trace(m_deferredScopingWork);
775 visitor->trace(m_findMatchesCache); 779 visitor->trace(m_findMatchesCache);
776 } 780 }
777 781
778 } // namespace blink 782 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698