| 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 18 matching lines...) Expand all Loading... |
| 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 | 33 |
| 34 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
| 35 #include "core/dom/ElementRareData.h" | 35 #include "core/dom/ElementRareData.h" |
| 36 #include "core/frame/FrameHost.h" | 36 #include "core/frame/FrameHost.h" |
| 37 #include "core/layout/LayoutObject.h" | 37 #include "core/layout/LayoutObject.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/SizeAssertions.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 struct SameSizeAsNodeRareData { | 43 ASSERT_SIZE(NodeRareData, 16, 32); |
| 43 void* m_pointer[2]; | |
| 44 OwnPtrWillBeMember<NodeMutationObserverData> m_mutationObserverData; | |
| 45 unsigned m_bitfields; | |
| 46 }; | |
| 47 | |
| 48 static_assert(sizeof(NodeRareData) == sizeof(SameSizeAsNodeRareData), "NodeRareD
ata should stay small"); | |
| 49 | 44 |
| 50 DEFINE_TRACE_AFTER_DISPATCH(NodeRareData) | 45 DEFINE_TRACE_AFTER_DISPATCH(NodeRareData) |
| 51 { | 46 { |
| 52 visitor->trace(m_mutationObserverData); | 47 visitor->trace(m_mutationObserverData); |
| 53 // Do not keep empty NodeListsNodeData objects around. | 48 // Do not keep empty NodeListsNodeData objects around. |
| 54 if (m_nodeLists && m_nodeLists->isEmpty()) | 49 if (m_nodeLists && m_nodeLists->isEmpty()) |
| 55 m_nodeLists.clear(); | 50 m_nodeLists.clear(); |
| 56 else | 51 else |
| 57 visitor->trace(m_nodeLists); | 52 visitor->trace(m_nodeLists); |
| 58 } | 53 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 77 void NodeRareData::incrementConnectedSubframeCount(unsigned amount) | 72 void NodeRareData::incrementConnectedSubframeCount(unsigned amount) |
| 78 { | 73 { |
| 79 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION((m_connectedFrameCount + amount) <=
FrameHost::maxNumberOfFrames); | 74 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION((m_connectedFrameCount + amount) <=
FrameHost::maxNumberOfFrames); |
| 80 m_connectedFrameCount += amount; | 75 m_connectedFrameCount += amount; |
| 81 } | 76 } |
| 82 | 77 |
| 83 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow | 78 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow |
| 84 static_assert(FrameHost::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameC
ountBits), "Frame limit should fit in rare data count"); | 79 static_assert(FrameHost::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameC
ountBits), "Frame limit should fit in rare data count"); |
| 85 | 80 |
| 86 } // namespace blink | 81 } // namespace blink |
| OLD | NEW |