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

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: 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..1e6cb8f3d78f4b15c5aae18eb4f6277cff5b43c7 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,8 @@ DocumentParser::~DocumentParser()
void DocumentParser::trace(Visitor* visitor)
{
visitor->trace(m_document);
+ // HELPME(oilpan): Below doesn't compile
+ // visitor->trace(m_clients);
kouhei (in TOK) 2014/09/03 22:40:41 This gives me an error, but I don't know how to re
kouhei (in TOK) 2014/09/04 21:08:01 Resolved. We needed a #if ENABLE(OILPAN) here, as
}
void DocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder>)
@@ -74,6 +77,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 +105,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