Commit 0c06ca8c authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Oilpan: move TextFinder to the heap.

With WebLocalFrameImpl on the heap, this object no longer needs to use
persistent (or untraced) references.

R=haraken
BUG=340522

Review URL: https://codereview.chromium.org/674773003

git-svn-id: svn://svn.chromium.org/blink/trunk@184332 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d67f46f4
...@@ -50,9 +50,9 @@ class WebLocalFrameImpl; ...@@ -50,9 +50,9 @@ class WebLocalFrameImpl;
template <typename T> class WebVector; template <typename T> class WebVector;
class TextFinder { class TextFinder final : public NoBaseWillBeGarbageCollectedFinalized<TextFinder> {
public: public:
static PassOwnPtr<TextFinder> create(WebLocalFrameImpl& ownerFrame); static PassOwnPtrWillBeRawPtr<TextFinder> create(WebLocalFrameImpl& ownerFrame);
bool find( bool find(
int identifier, const WebString& searchText, const WebFindOptions&, int identifier, const WebString& searchText, const WebFindOptions&,
...@@ -91,6 +91,10 @@ public: ...@@ -91,6 +91,10 @@ public:
class FindMatch { class FindMatch {
ALLOW_ONLY_INLINE_ALLOCATION(); ALLOW_ONLY_INLINE_ALLOCATION();
public: public:
FindMatch(PassRefPtrWillBeRawPtr<Range>, int ordinal);
void trace(Visitor*);
RefPtrWillBeMember<Range> m_range; RefPtrWillBeMember<Range> m_range;
// 1-based index within this frame. // 1-based index within this frame.
...@@ -99,12 +103,10 @@ public: ...@@ -99,12 +103,10 @@ public:
// In find-in-page coordinates. // In find-in-page coordinates.
// Lazily calculated by updateFindMatchRects. // Lazily calculated by updateFindMatchRects.
FloatRect m_rect; FloatRect m_rect;
FindMatch(PassRefPtrWillBeRawPtr<Range>, int ordinal);
void trace(Visitor*);
}; };
void trace(Visitor*);
private: private:
class DeferredScopeStringMatches; class DeferredScopeStringMatches;
friend class DeferredScopeStringMatches; friend class DeferredScopeStringMatches;
...@@ -185,17 +187,23 @@ private: ...@@ -185,17 +187,23 @@ private:
void decrementFramesScopingCount(int identifier); void decrementFramesScopingCount(int identifier);
WebLocalFrameImpl& ownerFrame() const
{
ASSERT(m_ownerFrame);
return *m_ownerFrame;
}
// Returns the ordinal of the first match in the owner frame. // Returns the ordinal of the first match in the owner frame.
int ordinalOfFirstMatch() const; int ordinalOfFirstMatch() const;
WebLocalFrameImpl& m_ownerFrame; RawPtrWillBeMember<WebLocalFrameImpl> m_ownerFrame;
// A way for the main frame to keep track of which frame has an active // A way for the main frame to keep track of which frame has an active
// match. Should be 0 for all other frames. // match. Should be 0 for all other frames.
WebLocalFrameImpl* m_currentActiveMatchFrame; RawPtrWillBeMember<WebLocalFrameImpl> m_currentActiveMatchFrame;
// The range of the active match for the current frame. // The range of the active match for the current frame.
RefPtrWillBePersistent<Range> m_activeMatch; RefPtrWillBeMember<Range> m_activeMatch;
// The index of the active match for the current frame. // The index of the active match for the current frame.
int m_activeMatchIndexInCurrentFrame; int m_activeMatchIndexInCurrentFrame;
...@@ -205,7 +213,7 @@ private: ...@@ -205,7 +213,7 @@ private:
// //
// This range is collapsed to the end position of the last successful // This range is collapsed to the end position of the last successful
// search; the new search should start from this position. // search; the new search should start from this position.
RefPtrWillBePersistent<Range> m_resumeScopingFromRange; RefPtrWillBeMember<Range> m_resumeScopingFromRange;
// Keeps track of the last string this frame searched for. This is used for // Keeps track of the last string this frame searched for. This is used for
// short-circuiting searches in the following scenarios: When a frame has // short-circuiting searches in the following scenarios: When a frame has
...@@ -237,14 +245,14 @@ private: ...@@ -237,14 +245,14 @@ private:
int m_nextInvalidateAfter; int m_nextInvalidateAfter;
// A list of all of the pending calls to scopeStringMatches. // A list of all of the pending calls to scopeStringMatches.
Vector<DeferredScopeStringMatches*> m_deferredScopingWork; WillBeHeapVector<OwnPtrWillBeMember<DeferredScopeStringMatches> > m_deferredScopingWork;
// Version number incremented on the main frame only whenever the document // Version number incremented on the main frame only whenever the document
// find-in-page match markers change. It should be 0 for all other frames. // find-in-page match markers change. It should be 0 for all other frames.
int m_findMatchMarkersVersion; int m_findMatchMarkersVersion;
// Local cache of the find match markers currently displayed for this frame. // Local cache of the find match markers currently displayed for this frame.
WillBePersistentHeapVector<FindMatch> m_findMatchesCache; WillBeHeapVector<FindMatch> m_findMatchesCache;
// Contents size when find-in-page match rects were last computed for this // Contents size when find-in-page match rects were last computed for this
// frame's cache. // frame's cache.
...@@ -271,4 +279,4 @@ private: ...@@ -271,4 +279,4 @@ private:
WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch); WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch);
#endif #endif // TextFinder_h
...@@ -1554,13 +1554,16 @@ WebLocalFrameImpl::~WebLocalFrameImpl() ...@@ -1554,13 +1554,16 @@ WebLocalFrameImpl::~WebLocalFrameImpl()
Platform::current()->decrementStatsCounter(webFrameActiveCount); Platform::current()->decrementStatsCounter(webFrameActiveCount);
frameCount--; frameCount--;
#if !ENABLE(OILPAN)
cancelPendingScopingEffort(); cancelPendingScopingEffort();
#endif
} }
#if ENABLE(OILPAN) #if ENABLE(OILPAN)
void WebLocalFrameImpl::trace(Visitor* visitor) void WebLocalFrameImpl::trace(Visitor* visitor)
{ {
visitor->trace(m_frame); visitor->trace(m_frame);
visitor->trace(m_textFinder);
visitor->trace(m_printContext); visitor->trace(m_printContext);
visitor->trace(m_geolocationClientProxy); visitor->trace(m_geolocationClientProxy);
visitor->registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(this); visitor->registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(this);
......
...@@ -343,7 +343,7 @@ private: ...@@ -343,7 +343,7 @@ private:
OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient;
// Will be initialized after first call to find() or scopeStringMatches(). // Will be initialized after first call to find() or scopeStringMatches().
OwnPtr<TextFinder> m_textFinder; OwnPtrWillBeMember<TextFinder> m_textFinder;
// Valid between calls to BeginPrint() and EndPrint(). Containts the print // Valid between calls to BeginPrint() and EndPrint(). Containts the print
// information. Is used by PrintPage(). // information. Is used by PrintPage().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment