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

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

Issue 292503006: Oilpan: add [WillBeGarbageCollected] for Node. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clear document touch event handlers upon losing DOMWindow. 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 1d88dad2de2f487beae9c3360d3be30767429b41..76b9c406255dca4a870404fec9ed4e20245a3748 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -927,13 +927,13 @@ bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, Pass
return true;
}
-PassRefPtr<Node> Document::importNode(Node* importedNode, ExceptionState& ec)
+PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, ExceptionState& ec)
{
UseCounter::countDeprecation(this, UseCounter::DocumentImportNodeOptionalArgument);
return importNode(importedNode, true, ec);
}
-PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& exceptionState)
{
if (!importedNode) {
exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node"));
@@ -961,7 +961,7 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
exceptionState.throwDOMException(NamespaceError, "The imported node has an invalid namespace.");
return nullptr;
}
- RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);
+ RefPtrWillBeRawPtr<Element> newElement = createElement(oldElement->tagQName(), false);
newElement->cloneDataFromElement(*oldElement);
@@ -5720,6 +5720,13 @@ void Document::clearWeakMembers(Visitor* visitor)
for (unsigned i = 0; i < deadNodes.size(); ++i)
didClearTouchEventHandlers(deadNodes[i]);
}
+ if (m_domWindow && !visitor->isAlive(m_domWindow)) {
+ // Oilpan: this mirrors the clearing of the document object's touch
+ // handlers that happen when the DOMWindow is destructed in a non-Oilpan
+ // setting (done via DOMWindow::removeAllEventListeners().)
+ didClearTouchEventHandlers(this);
+ m_domWindow.clear();
+ }
}
void Document::trace(Visitor* visitor)

Powered by Google App Engine
This is Rietveld 408576698