| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/NodeRareData.h" | 32 #include "core/dom/NodeRareData.h" |
| 33 #include "core/dom/Element.h" | 33 #include "core/dom/Element.h" |
| 34 #include "core/dom/ElementRareData.h" |
| 34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 35 | 36 |
| 36 namespace WebCore { | 37 namespace WebCore { |
| 37 | 38 |
| 38 struct SameSizeAsNodeRareData { | 39 struct SameSizeAsNodeRareData { |
| 39 void* m_pointer[2]; | 40 void* m_pointer[2]; |
| 40 OwnPtrWillBePersistent<NodeMutationObserverData> m_mutationObserverData; | 41 OwnPtrWillBeMember<NodeMutationObserverData> m_mutationObserverData; |
| 41 unsigned m_bitfields; | 42 unsigned m_bitfields; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 COMPILE_ASSERT(sizeof(NodeRareData) == sizeof(SameSizeAsNodeRareData), NodeRareD
ataShouldStaySmall); | 45 COMPILE_ASSERT(sizeof(NodeRareData) == sizeof(SameSizeAsNodeRareData), NodeRareD
ataShouldStaySmall); |
| 45 | 46 |
| 46 void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName) | 47 void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName) |
| 47 { | 48 { |
| 48 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicName
Caches.end(); | 49 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicName
Caches.end(); |
| 49 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begi
n(); it != atomicNameCacheEnd; ++it) | 50 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begi
n(); it != atomicNameCacheEnd; ++it) |
| 50 it->value->invalidateCacheForAttribute(attrName); | 51 it->value->invalidateCacheForAttribute(attrName); |
| 51 | 52 |
| 52 if (attrName) | 53 if (attrName) |
| 53 return; | 54 return; |
| 54 | 55 |
| 55 TagCollectionCacheNS::iterator tagCacheEnd = m_tagCollectionCacheNS.end(); | 56 TagCollectionCacheNS::iterator tagCacheEnd = m_tagCollectionCacheNS.end(); |
| 56 for (TagCollectionCacheNS::iterator it = m_tagCollectionCacheNS.begin(); it
!= tagCacheEnd; ++it) | 57 for (TagCollectionCacheNS::iterator it = m_tagCollectionCacheNS.begin(); it
!= tagCacheEnd; ++it) |
| 57 it->value->invalidateCache(); | 58 it->value->invalidateCache(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void NodeRareData::dispose() | 61 void NodeRareData::traceAfterDispatch(Visitor* visitor) |
| 61 { | 62 { |
| 62 if (m_mutationObserverData) { | 63 visitor->trace(m_mutationObserverData); |
| 63 for (unsigned i = 0; i < m_mutationObserverData->registry.size(); i++) | 64 } |
| 64 m_mutationObserverData->registry.at(i)->dispose(); | 65 |
| 65 m_mutationObserverData.clear(); | 66 void NodeRareData::trace(Visitor* visitor) |
| 66 } | 67 { |
| 68 if (m_isElementRareData) |
| 69 static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor); |
| 70 else |
| 71 traceAfterDispatch(visitor); |
| 72 } |
| 73 |
| 74 void NodeRareData::finalizeGarbageCollectedObject() |
| 75 { |
| 76 RELEASE_ASSERT(!renderer()); |
| 77 if (m_isElementRareData) |
| 78 static_cast<ElementRareData*>(this)->~ElementRareData(); |
| 79 else |
| 80 this->~NodeRareData(); |
| 67 } | 81 } |
| 68 | 82 |
| 69 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow | 83 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow |
| 70 COMPILE_ASSERT(Page::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameCount
Bits), Frame_limit_should_fit_in_rare_data_count); | 84 COMPILE_ASSERT(Page::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameCount
Bits), Frame_limit_should_fit_in_rare_data_count); |
| 71 | 85 |
| 72 } // namespace WebCore | 86 } // namespace WebCore |
| OLD | NEW |