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

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

Issue 2860293002: Change cc::ElementId to be a uint64_t (Closed)
Patch Set: none 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..16affaa30f8f92dd92c9efe4c5c12c3fe3a68f11 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() / kNumSubElementTypes);
+ CompositorElementId element_id;
+ element_id.id = dom_node_id;
+ element_id.id = element_id.id
suzyh_UTC10 (ex-contributor) 2017/05/08 01:04:15 Could you just write element_id.id = dom_node_id <
chrishtr 2017/05/08 16:32:13 Done.
+ << 2; // Shift to make room for sub_element_id enum bits.
+ element_id.id += static_cast<uint64_t>(sub_element_id);
+ return element_id;
+}
+
+DOMNodeId DomNodeIdFromCompositorElementId(CompositorElementId element_id) {
+ return element_id.id >> 2;
+}
+
+CompositorSubElementId SubElementIdFromCompositorElementId(
suzyh_UTC10 (ex-contributor) 2017/05/08 01:04:15 Do these functions belong inside the definition of
chrishtr 2017/05/08 16:32:13 No, because that type is defined in cc and by desi
+ CompositorElementId element_id) {
+ return static_cast<CompositorSubElementId>(element_id.id %
+ kNumSubElementTypes);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698