Chromium Code Reviews

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

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.
Jump to:
View side-by-side diff with in-line comments
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 241c62f3c20656a65b4b824ff15af8159d15036e..9e354ce4a3076bd58f48fecfcc6aa36d55eaa521 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -57,6 +57,10 @@ namespace WebCore {
DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, rangeCounter, ("Range"));
+#if ENABLE(OILPAN)
+unsigned TemporaryRangeScope::s_nesting = 0;
+#endif
+
inline Range::Range(Document& ownerDocument)
: m_ownerDocument(&ownerDocument)
, m_start(m_ownerDocument)
@@ -65,9 +69,9 @@ inline Range::Range(Document& ownerDocument)
#ifndef NDEBUG
rangeCounter.increment();
#endif
-
ScriptWrappable::init(this);
- m_ownerDocument->attachRange(this);
+ if (!TemporaryRangeScope::active())
haraken 2014/06/24 12:24:22 You can move this check into Document::attachRange
+ m_ownerDocument->attachRange(this);
}
PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument)
@@ -83,9 +87,9 @@ inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
#ifndef NDEBUG
rangeCounter.increment();
#endif
-
ScriptWrappable::init(this);
- m_ownerDocument->attachRange(this);
+ if (!TemporaryRangeScope::active())
haraken 2014/06/24 12:24:22 Ditto.
+ m_ownerDocument->attachRange(this);
// Simply setting the containers and offsets directly would not do any of the checking
// that setStart and setEnd do, so we call those functions.

Powered by Google App Engine