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

Unified Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
index 49193da48cd4fa00a7040578e4de49e96bd73425..84c25a94d6964e00e81c055a24137aef0ef21a84 100644
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -416,6 +416,10 @@ bool XMLDocumentParser::updateLeafTextNode()
void XMLDocumentParser::detach()
{
+ if (m_pendingScript) {
+ m_pendingScript->removeClient(this);
+ m_pendingScript = nullptr;
+ }
clearCurrentNodeStack();
ScriptableDocumentParser::detach();
}
@@ -486,7 +490,7 @@ void XMLDocumentParser::notifyFinished(Resource* unusedResource)
bool wasCanceled = m_pendingScript->wasCanceled();
m_pendingScript->removeClient(this);
- m_pendingScript = 0;
+ m_pendingScript = nullptr;
RefPtrWillBeRawPtr<Element> e = m_scriptElement;
m_scriptElement = nullptr;
@@ -673,7 +677,7 @@ static void* openFunc(const char* uri)
XMLDocumentParserScope scope(0);
// FIXME: We should restore the original global error handler as well.
FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, ResourceFetcher::defaultResourceOptions());
- ResourcePtr<Resource> resource = RawResource::fetchSynchronously(request, document->fetcher());
+ RefPtrWillBeRawPtr<Resource> resource = RawResource::fetchSynchronously(request, document->fetcher());
if (resource && !resource->errorOccurred()) {
data = resource->resourceBuffer();
finalURL = resource->response().url();
@@ -802,7 +806,6 @@ XMLDocumentParser::XMLDocumentParser(Document& document, FrameView* frameView)
, m_requestingScript(false)
, m_finishCalled(false)
, m_xmlErrors(&document)
- , m_pendingScript(0)
, m_scriptStartPosition(TextPosition::belowRangePosition())
, m_parsingFragment(false)
{
@@ -826,7 +829,6 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
, m_requestingScript(false)
, m_finishCalled(false)
, m_xmlErrors(&fragment->document())
- , m_pendingScript(0)
, m_scriptStartPosition(TextPosition::belowRangePosition())
, m_parsingFragment(true)
{
@@ -873,15 +875,12 @@ XMLParserContext::~XMLParserContext()
XMLDocumentParser::~XMLDocumentParser()
{
+ ASSERT(!m_pendingScript);
#if !ENABLE(OILPAN)
// The XMLDocumentParser will always be detached before being destroyed.
ASSERT(m_currentNodeStack.isEmpty());
ASSERT(!m_currentNode);
#endif
-
- // FIXME: m_pendingScript handling should be moved into XMLDocumentParser.cpp!
- if (m_pendingScript)
- m_pendingScript->removeClient(this);
}
DEFINE_TRACE(XMLDocumentParser)
@@ -892,6 +891,7 @@ DEFINE_TRACE(XMLDocumentParser)
#endif
visitor->trace(m_leafTextNode);
visitor->trace(m_xmlErrors);
+ visitor->trace(m_pendingScript);
visitor->trace(m_scriptElement);
ScriptableDocumentParser::trace(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698