| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4219 } | 4219 } |
| 4220 | 4220 |
| 4221 void Document::setCSSTarget(Element* newTarget) { | 4221 void Document::setCSSTarget(Element* newTarget) { |
| 4222 if (m_cssTarget) | 4222 if (m_cssTarget) |
| 4223 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); | 4223 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); |
| 4224 m_cssTarget = newTarget; | 4224 m_cssTarget = newTarget; |
| 4225 if (m_cssTarget) | 4225 if (m_cssTarget) |
| 4226 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); | 4226 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); |
| 4227 } | 4227 } |
| 4228 | 4228 |
| 4229 static void liveNodeListBaseWriteBarrier(void* parent, | |
| 4230 const LiveNodeListBase* list) { | |
| 4231 if (isHTMLCollectionType(list->type())) { | |
| 4232 ScriptWrappableVisitor::writeBarrier( | |
| 4233 parent, static_cast<const HTMLCollection*>(list)); | |
| 4234 } else { | |
| 4235 ScriptWrappableVisitor::writeBarrier( | |
| 4236 parent, static_cast<const LiveNodeList*>(list)); | |
| 4237 } | |
| 4238 } | |
| 4239 | |
| 4240 void Document::registerNodeList(const LiveNodeListBase* list) { | 4229 void Document::registerNodeList(const LiveNodeListBase* list) { |
| 4241 DCHECK(!m_nodeLists[list->invalidationType()].contains(list)); | 4230 DCHECK(!m_nodeLists[list->invalidationType()].contains(list)); |
| 4242 m_nodeLists[list->invalidationType()].insert(list); | 4231 m_nodeLists[list->invalidationType()].insert(list); |
| 4243 liveNodeListBaseWriteBarrier(this, list); | |
| 4244 if (list->isRootedAtTreeScope()) | 4232 if (list->isRootedAtTreeScope()) |
| 4245 m_listsInvalidatedAtDocument.insert(list); | 4233 m_listsInvalidatedAtDocument.insert(list); |
| 4246 } | 4234 } |
| 4247 | 4235 |
| 4248 void Document::unregisterNodeList(const LiveNodeListBase* list) { | 4236 void Document::unregisterNodeList(const LiveNodeListBase* list) { |
| 4249 DCHECK(m_nodeLists[list->invalidationType()].contains(list)); | 4237 DCHECK(m_nodeLists[list->invalidationType()].contains(list)); |
| 4250 m_nodeLists[list->invalidationType()].erase(list); | 4238 m_nodeLists[list->invalidationType()].erase(list); |
| 4251 if (list->isRootedAtTreeScope()) { | 4239 if (list->isRootedAtTreeScope()) { |
| 4252 DCHECK(m_listsInvalidatedAtDocument.contains(list)); | 4240 DCHECK(m_listsInvalidatedAtDocument.contains(list)); |
| 4253 m_listsInvalidatedAtDocument.erase(list); | 4241 m_listsInvalidatedAtDocument.erase(list); |
| 4254 } | 4242 } |
| 4255 } | 4243 } |
| 4256 | 4244 |
| 4257 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) { | 4245 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) { |
| 4258 DCHECK(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); | 4246 DCHECK(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); |
| 4259 m_nodeLists[InvalidateOnIdNameAttrChange].insert(list); | 4247 m_nodeLists[InvalidateOnIdNameAttrChange].insert(list); |
| 4260 liveNodeListBaseWriteBarrier(this, list); | |
| 4261 } | 4248 } |
| 4262 | 4249 |
| 4263 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) { | 4250 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) { |
| 4264 DCHECK(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); | 4251 DCHECK(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); |
| 4265 m_nodeLists[InvalidateOnIdNameAttrChange].erase(list); | 4252 m_nodeLists[InvalidateOnIdNameAttrChange].erase(list); |
| 4266 } | 4253 } |
| 4267 | 4254 |
| 4268 void Document::attachNodeIterator(NodeIterator* ni) { | 4255 void Document::attachNodeIterator(NodeIterator* ni) { |
| 4269 m_nodeIterators.insert(ni); | 4256 m_nodeIterators.insert(ni); |
| 4270 } | 4257 } |
| (...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6578 for (int i = m_wouldLoadReason + 1; i <= reason; ++i) | 6565 for (int i = m_wouldLoadReason + 1; i <= reason; ++i) |
| 6579 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i)); | 6566 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i)); |
| 6580 m_wouldLoadReason = reason; | 6567 m_wouldLoadReason = reason; |
| 6581 } | 6568 } |
| 6582 | 6569 |
| 6583 DEFINE_TRACE_WRAPPERS(Document) { | 6570 DEFINE_TRACE_WRAPPERS(Document) { |
| 6584 visitor->traceWrappers(m_importsController); | 6571 visitor->traceWrappers(m_importsController); |
| 6585 visitor->traceWrappers(m_implementation); | 6572 visitor->traceWrappers(m_implementation); |
| 6586 visitor->traceWrappers(m_styleSheetList); | 6573 visitor->traceWrappers(m_styleSheetList); |
| 6587 visitor->traceWrappers(m_styleEngine); | 6574 visitor->traceWrappers(m_styleEngine); |
| 6588 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { | |
| 6589 for (auto list : m_nodeLists[i]) { | |
| 6590 if (isHTMLCollectionType(list->type())) { | |
| 6591 visitor->traceWrappersWithManualWriteBarrier( | |
| 6592 static_cast<const HTMLCollection*>(list.get())); | |
| 6593 } else { | |
| 6594 visitor->traceWrappersWithManualWriteBarrier( | |
| 6595 static_cast<const LiveNodeList*>(list.get())); | |
| 6596 } | |
| 6597 } | |
| 6598 } | |
| 6599 // Cannot trace in Supplementable<Document> as it is part of platform/ and | 6575 // Cannot trace in Supplementable<Document> as it is part of platform/ and |
| 6600 // thus cannot refer to ScriptWrappableVisitor. | 6576 // thus cannot refer to ScriptWrappableVisitor. |
| 6601 visitor->traceWrappers( | 6577 visitor->traceWrappers( |
| 6602 static_cast<FontFaceSet*>(Supplementable<Document>::m_supplements.at( | 6578 static_cast<FontFaceSet*>(Supplementable<Document>::m_supplements.at( |
| 6603 FontFaceSet::supplementName()))); | 6579 FontFaceSet::supplementName()))); |
| 6604 ContainerNode::traceWrappers(visitor); | 6580 ContainerNode::traceWrappers(visitor); |
| 6605 } | 6581 } |
| 6606 | 6582 |
| 6607 template class CORE_TEMPLATE_EXPORT Supplement<Document>; | 6583 template class CORE_TEMPLATE_EXPORT Supplement<Document>; |
| 6608 | 6584 |
| 6609 } // namespace blink | 6585 } // namespace blink |
| 6610 | 6586 |
| 6611 #ifndef NDEBUG | 6587 #ifndef NDEBUG |
| 6612 static WeakDocumentSet& liveDocumentSet() { | 6588 static WeakDocumentSet& liveDocumentSet() { |
| 6613 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); | 6589 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); |
| 6614 return set; | 6590 return set; |
| 6615 } | 6591 } |
| 6616 | 6592 |
| 6617 void showLiveDocumentInstances() { | 6593 void showLiveDocumentInstances() { |
| 6618 WeakDocumentSet& set = liveDocumentSet(); | 6594 WeakDocumentSet& set = liveDocumentSet(); |
| 6619 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6595 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6620 for (blink::Document* document : set) | 6596 for (blink::Document* document : set) |
| 6621 fprintf(stderr, "- Document %p URL: %s\n", document, | 6597 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6622 document->url().getString().utf8().data()); | 6598 document->url().getString().utf8().data()); |
| 6623 } | 6599 } |
| 6624 #endif | 6600 #endif |
| OLD | NEW |