Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Unified Diff: Source/core/dom/NodeRareData.h

Issue 201153006: Move element flags from ElementRareData to NodeRareData (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased (another ElementFlag added upstream) Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ElementRareData.cpp ('k') | Source/core/dom/NodeRareData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeRareData.h
diff --git a/Source/core/dom/NodeRareData.h b/Source/core/dom/NodeRareData.h
index b127e7eed1e05be94243493905fe82bbf5d5e0b1..71a66463a0f972ac480769add93cb694967420db 100644
--- a/Source/core/dom/NodeRareData.h
+++ b/Source/core/dom/NodeRareData.h
@@ -255,17 +255,28 @@ public:
m_connectedFrameCount -= amount;
}
+ bool hasFlag(ElementFlags mask) const { return m_elementFlags & mask; }
+ void setFlag(ElementFlags mask, bool value) { m_elementFlags = (m_elementFlags & ~mask) | (-(int32_t)value & mask); }
+ void clearFlag(ElementFlags mask) { m_elementFlags &= ~mask; }
+
+ enum {
+ ConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames.
+ ElementFlagsBits = 17, // Must fit the ElementFlags enumeration.
+ };
+
protected:
NodeRareData(RenderObject* renderer)
: NodeRareDataBase(renderer)
, m_connectedFrameCount(0)
+ , m_elementFlags(0)
{ }
private:
- unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames.
-
OwnPtr<NodeListsNodeData> m_nodeLists;
OwnPtr<NodeMutationObserverData> m_mutationObserverData;
+
+ unsigned m_connectedFrameCount : ConnectedFrameCountBits;
+ unsigned m_elementFlags : ElementFlagsBits;
};
inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(Node& ownerNode)
@@ -277,9 +288,6 @@ inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas
return true;
}
-// Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
-COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_data_count);
-
} // namespace WebCore
#endif // NodeRareData_h
« no previous file with comments | « Source/core/dom/ElementRareData.cpp ('k') | Source/core/dom/NodeRareData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698