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

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 cc::ElementIdType id =
16 dom_node_id << 2; // Shift to make room for sub_element_id enum bits.
17 id += static_cast<uint64_t>(sub_element_id);
18 return CompositorElementId(id);
19 }
20
21 DOMNodeId DomNodeIdFromCompositorElementId(CompositorElementId element_id) {
22 return element_id.id_ >> 2;
23 }
24
25 CompositorSubElementId SubElementIdFromCompositorElementId(
26 CompositorElementId element_id) {
27 return static_cast<CompositorSubElementId>(
28 element_id.id_ % CompositorSubElementId::kNumSubElementTypes);
13 } 29 }
14 30
15 } // namespace blink 31 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698