| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 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 "core/dom/NodeRareData.h" | 31 #include "core/dom/NodeRareData.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
| 33 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
| 34 #include "core/dom/ElementRareData.h" | 35 #include "core/dom/ElementRareData.h" |
| 35 #include "core/frame/FrameHost.h" | 36 #include "core/frame/FrameHost.h" |
| 36 #include "core/layout/LayoutObject.h" | 37 #include "core/layout/LayoutObject.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 struct SameSizeAsNodeRareData { | 42 struct SameSizeAsNodeRareData { |
| 42 void* m_pointer; | 43 void* m_pointer; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 } | 58 } |
| 58 | 59 |
| 59 DEFINE_TRACE(NodeRareData) | 60 DEFINE_TRACE(NodeRareData) |
| 60 { | 61 { |
| 61 if (m_isElementRareData) | 62 if (m_isElementRareData) |
| 62 static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor); | 63 static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor); |
| 63 else | 64 else |
| 64 traceAfterDispatch(visitor); | 65 traceAfterDispatch(visitor); |
| 65 } | 66 } |
| 66 | 67 |
| 68 DEFINE_TRACE_WRAPPERS(NodeRareData) |
| 69 { |
| 70 } |
| 71 |
| 67 void NodeRareData::finalizeGarbageCollectedObject() | 72 void NodeRareData::finalizeGarbageCollectedObject() |
| 68 { | 73 { |
| 69 RELEASE_ASSERT(!layoutObject()); | 74 RELEASE_ASSERT(!layoutObject()); |
| 70 if (m_isElementRareData) | 75 if (m_isElementRareData) |
| 71 static_cast<ElementRareData*>(this)->~ElementRareData(); | 76 static_cast<ElementRareData*>(this)->~ElementRareData(); |
| 72 else | 77 else |
| 73 this->~NodeRareData(); | 78 this->~NodeRareData(); |
| 74 } | 79 } |
| 75 | 80 |
| 76 void NodeRareData::incrementConnectedSubframeCount() | 81 void NodeRareData::incrementConnectedSubframeCount() |
| 77 { | 82 { |
| 78 SECURITY_CHECK((m_connectedFrameCount + 1) <= FrameHost::maxNumberOfFrames); | 83 SECURITY_CHECK((m_connectedFrameCount + 1) <= FrameHost::maxNumberOfFrames); |
| 79 ++m_connectedFrameCount; | 84 ++m_connectedFrameCount; |
| 80 } | 85 } |
| 81 | 86 |
| 82 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow | 87 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow |
| 83 static_assert(FrameHost::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameC
ountBits), "Frame limit should fit in rare data count"); | 88 static_assert(FrameHost::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameC
ountBits), "Frame limit should fit in rare data count"); |
| 84 | 89 |
| 85 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |