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

Unified Diff: Source/core/dom/Range.h

Issue 330383004: Oilpan: Introduce TempRangeScope to avoid needless Range attaches on Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments. Created 6 years, 6 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/core/dom/Range.h
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index bb0f769176188a0d54de33ed3dabf43b39608e5b..fd653d9debce39e19f76ffe0b53b2b0d2b16faf5 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -170,6 +170,32 @@ private:
RangeBoundaryPoint m_end;
};
+#if ENABLE(OILPAN)
+// Ranges are registered on the owner document so that they can be
+// updated via the document when the document changes. Ranges are
+// often used as short-lived results of subcomputations that become
+// unreachable without any document modifications. Such short-lived
+// ranges need not be registered with the document. When a
+// TemporaryRangeScope is on the stack created range objects are not
+// attached to the document. With Oilpan this is important to not
+// build up a large set of ranges on the Document that we will waste
+// time updating even though they will never be needed.
+class TemporaryRangeScope {
+public:
+ TemporaryRangeScope() { ++s_nesting; }
+ ~TemporaryRangeScope() { --s_nesting; }
+ static bool active() { return s_nesting != 0; }
yosin_UTC9 2014/06/25 01:22:20 nit: Just |return s_nesting|
+private:
+ static unsigned s_nesting;
+};
+#else
+class TemporaryRangeScope {
+public:
+ TemporaryRangeScope() { }
+ static bool active() { return false; }
+};
+#endif
+
PassRefPtrWillBeRawPtr<Range> rangeOfContents(Node*);
bool areRangesEqual(const Range*, const Range*);

Powered by Google App Engine
This is Rietveld 408576698