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

Unified Diff: third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp

Issue 2860293002: Change cc::ElementId to be a uint64_t (Closed)
Patch Set: Merge branch 'master' into secondaryid Created 3 years, 7 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
Index: third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp
index eeb495fbacd4780e0671a07ae53022b945c3aa39..eec2d1131b72df13f5a32912641ffd4d0026fd6b 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp
@@ -7,9 +7,27 @@
namespace blink {
CompositorElementId CreateCompositorElementId(
- int dom_node_id,
+ DOMNodeId dom_node_id,
CompositorSubElementId sub_element_id) {
- return CompositorElementId(dom_node_id, static_cast<int>(sub_element_id));
+ DCHECK(dom_node_id > 0 &&
+ dom_node_id < std::numeric_limits<DOMNodeId>::max() /
+ static_cast<unsigned>(
+ CompositorSubElementId::kNumSubElementTypes));
+ cc::ElementIdType id =
+ dom_node_id << 2; // Shift to make room for sub_element_id enum bits.
+ id += static_cast<uint64_t>(sub_element_id);
+ return CompositorElementId(id);
+}
+
+DOMNodeId DomNodeIdFromCompositorElementId(CompositorElementId element_id) {
+ return element_id.id_ >> 2;
+}
+
+CompositorSubElementId SubElementIdFromCompositorElementId(
+ CompositorElementId element_id) {
+ return static_cast<CompositorSubElementId>(
+ element_id.id_ %
+ static_cast<unsigned>(CompositorSubElementId::kNumSubElementTypes));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698