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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/CompositorElementId.h" 5 #include "platform/graphics/CompositorElementId.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 CompositorElementId CreateCompositorElementId( 9 CompositorElementId CreateCompositorElementId(
10 int dom_node_id, 10 DOMNodeId dom_node_id,
11 CompositorSubElementId sub_element_id) { 11 CompositorSubElementId sub_element_id) {
12 return CompositorElementId(dom_node_id, static_cast<int>(sub_element_id)); 12 DCHECK(dom_node_id > 0 &&
13 dom_node_id <
14 std::numeric_limits<DOMNodeId>::max() / kNumSubElementTypes);
15 CompositorElementId element_id;
16 element_id.id = dom_node_id;
17 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.
18 << 2; // Shift to make room for sub_element_id enum bits.
19 element_id.id += static_cast<uint64_t>(sub_element_id);
20 return element_id;
21 }
22
23 DOMNodeId DomNodeIdFromCompositorElementId(CompositorElementId element_id) {
24 return element_id.id >> 2;
25 }
26
27 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
28 CompositorElementId element_id) {
29 return static_cast<CompositorSubElementId>(element_id.id %
30 kNumSubElementTypes);
13 } 31 }
14 32
15 } // namespace blink 33 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698