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

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

Issue 301233010: Oilpan: use transition types for remaining RefPtr<Document>s in dom/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have Document weakly track its attached Ranges Created 6 years, 7 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentMarkerControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 298c602884fe7b76f02d5a09127feda70e1e4d00..6c41759e9075fa40a77611faadd2d4b1d84d57d9 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -531,9 +531,9 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
Document::~Document()
{
ASSERT(!renderView());
- ASSERT(m_ranges.isEmpty());
ASSERT(!parentTreeScope());
#if !ENABLE(OILPAN)
+ ASSERT(m_ranges.isEmpty());
ASSERT(!hasGuardRefCount());
// With Oilpan, either the document outlives the visibility observers
// or the visibility observers and the document die in the same GC round.
@@ -2645,7 +2645,7 @@ bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
if (!body())
return true;
- RefPtr<Document> protect(this);
+ RefPtrWillBeRawPtr<Document> protect(this);
RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create();
m_loadEventProgress = BeforeUnloadEventInProgress;
@@ -2671,7 +2671,7 @@ bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
void Document::dispatchUnloadEvents()
{
- RefPtr<Document> protect(this);
+ RefPtrWillBeRawPtr<Document> protect(this);
if (m_parser)
m_parser->stopParsing();
@@ -3778,8 +3778,8 @@ void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
void Document::updateRangesAfterChildrenChanged(ContainerNode* container)
{
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->nodeChildrenChanged(container);
}
}
@@ -3788,8 +3788,8 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode& container)
{
NoEventDispatchAssertion assertNoEventDispatch;
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->nodeChildrenWillBeRemoved(container);
}
@@ -3815,8 +3815,8 @@ void Document::nodeWillBeRemoved(Node& n)
(*it)->nodeWillBeRemoved(n);
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator rangesEnd = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it)
+ AttachedRangeSet::const_iterator rangesEnd = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it)
(*it)->nodeWillBeRemoved(n);
}
@@ -3830,8 +3830,8 @@ void Document::nodeWillBeRemoved(Node& n)
void Document::didInsertText(Node* text, unsigned offset, unsigned length)
{
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->didInsertText(text, offset, length);
}
@@ -3842,8 +3842,8 @@ void Document::didInsertText(Node* text, unsigned offset, unsigned length)
void Document::didRemoveText(Node* text, unsigned offset, unsigned length)
{
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->didRemoveText(text, offset, length);
}
@@ -3856,8 +3856,8 @@ void Document::didMergeTextNodes(Text& oldNode, unsigned offset)
{
if (!m_ranges.isEmpty()) {
NodeWithIndex oldNodeWithIndex(oldNode);
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->didMergeTextNodes(oldNodeWithIndex, offset);
}
@@ -3870,8 +3870,8 @@ void Document::didMergeTextNodes(Text& oldNode, unsigned offset)
void Document::didSplitTextNode(Text& oldNode)
{
if (!m_ranges.isEmpty()) {
- HashSet<Range*>::const_iterator end = m_ranges.end();
- for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+ AttachedRangeSet::const_iterator end = m_ranges.end();
+ for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
(*it)->didSplitTextNode(oldNode);
}
@@ -4654,7 +4654,7 @@ void Document::finishedParsing()
// The loader's finishedParsing() method may invoke script that causes this object to
// be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
// Keep it alive until we are done.
- RefPtr<Document> protect(this);
+ RefPtrWillBeRawPtr<Document> protect(this);
if (RefPtr<LocalFrame> f = frame()) {
// Don't update the render tree if we haven't requested the main resource yet to avoid
@@ -5804,6 +5804,7 @@ void Document::trace(Visitor* visitor)
visitor->trace(m_topLayerElements);
visitor->trace(m_elemSheet);
visitor->trace(m_nodeIterators);
+ visitor->trace(m_ranges);
visitor->trace(m_styleEngine);
visitor->trace(m_formController);
visitor->trace(m_domWindow);
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentMarkerControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698