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