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); |
+} |
+ |
}; |