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

Unified Diff: Source/web/TextFinder.h

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/web/TextFinder.h
diff --git a/Source/web/TextFinder.h b/Source/web/TextFinder.h
index a3b18ec177b16638adb5e0d5377a416d9a688da8..f71702f06e1837556d3d5f52871f4d862dd955d6 100644
--- a/Source/web/TextFinder.h
+++ b/Source/web/TextFinder.h
@@ -34,6 +34,7 @@
#include "WebFindOptions.h"
#include "core/editing/FindOptions.h"
#include "platform/geometry/FloatRect.h"
+#include "platform/heap/Handle.h"
#include "public/platform/WebFloatPoint.h"
#include "public/platform/WebFloatRect.h"
#include "public/platform/WebRect.h"
@@ -89,12 +90,10 @@ public:
~TextFinder();
-private:
- class DeferredScopeStringMatches;
- friend class DeferredScopeStringMatches;
-
- struct FindMatch {
- RefPtr<WebCore::Range> m_range;
+ class FindMatch {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+ public:
+ RefPtrWillBeMember<WebCore::Range> m_range;
// 1-based index within this frame.
int m_ordinal;
@@ -103,9 +102,15 @@ private:
// Lazily calculated by updateFindMatchRects.
WebCore::FloatRect m_rect;
- FindMatch(PassRefPtr<WebCore::Range>, int ordinal);
+ FindMatch(PassRefPtrWillBeRawPtr<WebCore::Range>, int ordinal);
+
+ void trace(WebCore::Visitor*);
};
+private:
+ class DeferredScopeStringMatches;
+ friend class DeferredScopeStringMatches;
+
explicit TextFinder(WebFrameImpl& ownerFrame);
// Notifies the delegate about a new selection rect.
@@ -192,14 +197,14 @@ private:
WebFrameImpl* m_currentActiveMatchFrame;
// The range of the active match for the current frame.
- RefPtr<WebCore::Range> m_activeMatch;
+ RefPtrWillBePersistent<WebCore::Range> m_activeMatch;
// The index of the active match for the current frame.
int m_activeMatchIndexInCurrentFrame;
// The scoping effort can time out and we need to keep track of where we
// ended our last search so we can continue from where we left of.
- RefPtr<WebCore::Range> m_resumeScopingFromRange;
+ RefPtrWillBePersistent<WebCore::Range> m_resumeScopingFromRange;
// 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
@@ -238,7 +243,7 @@ private:
int m_findMatchMarkersVersion;
// Local cache of the find match markers currently displayed for this frame.
- Vector<FindMatch> m_findMatchesCache;
+ WillBePersistentHeapVector<FindMatch> m_findMatchesCache;
// Contents size when find-in-page match rects were last computed for this
// frame's cache.
@@ -263,4 +268,10 @@ private:
} // namespace blink
+namespace WTF {
+template <> struct VectorTraits<blink::TextFinder::FindMatch> : VectorTraitsBase<blink::TextFinder::FindMatch> {
+ static const bool canInitializeWithMemset = true;
+};
+}
+
#endif

Powered by Google App Engine
This is Rietveld 408576698