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

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

Issue 535403002: introduce DocumentParserClient to receive parser stopped notification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 3 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/DocumentParser.h ('k') | Source/core/dom/DocumentParserClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DocumentParser.cpp
diff --git a/Source/core/dom/DocumentParser.cpp b/Source/core/dom/DocumentParser.cpp
index 0cb33afb749a9c12862229eff4a62aea84b5627d..a9f93e8186a8a544e17fdde92b7b6ad161442b4d 100644
--- a/Source/core/dom/DocumentParser.cpp
+++ b/Source/core/dom/DocumentParser.cpp
@@ -27,6 +27,7 @@
#include "core/dom/DocumentParser.h"
#include "core/dom/Document.h"
+#include "core/dom/DocumentParserClient.h"
#include "core/html/parser/TextResourceDecoder.h"
#include "wtf/Assertions.h"
@@ -53,6 +54,9 @@ DocumentParser::~DocumentParser()
void DocumentParser::trace(Visitor* visitor)
{
visitor->trace(m_document);
+#if ENABLE(OILPAN)
+ visitor->trace(m_clients);
+#endif
}
void DocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder>)
@@ -74,6 +78,18 @@ void DocumentParser::prepareToStopParsing()
void DocumentParser::stopParsing()
{
m_state = StoppedState;
+
+ // Clients may be removed while in the loop. Make a snapshot for iteration.
+ WillBeHeapVector<RawPtrWillBeMember<DocumentParserClient> > clientsSnapshot;
+ copyToVector(m_clients, clientsSnapshot);
+
+ for (WillBeHeapVector<RawPtrWillBeMember<DocumentParserClient> >::const_iterator it = clientsSnapshot.begin(), itEnd = clientsSnapshot.end(); it != itEnd; ++it) {
+ DocumentParserClient* client = *it;
+ if (!m_clients.contains(client))
+ continue;
+
+ client->notifyParserStopped();
+ }
}
void DocumentParser::detach()
@@ -90,5 +106,15 @@ void DocumentParser::resumeScheduledTasks()
{
}
+void DocumentParser::addClient(DocumentParserClient* client)
+{
+ m_clients.add(client);
+}
+
+void DocumentParser::removeClient(DocumentParserClient* client)
+{
+ m_clients.remove(client);
+}
+
};
« no previous file with comments | « Source/core/dom/DocumentParser.h ('k') | Source/core/dom/DocumentParserClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698