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

Unified Diff: cc/trees/element_id.h

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: cc/trees/element_id.h
diff --git a/cc/trees/element_id.h b/cc/trees/element_id.h
index 8518cf8ce13393c93c8d01faf224f27620d5269c..e3be07e8281508acdb3e6c174e1cd9296e8115e6 100644
--- a/cc/trees/element_id.h
+++ b/cc/trees/element_id.h
@@ -6,22 +6,15 @@
#define CC_TREES_ELEMENT_ID_H_
#include <stddef.h>
+#include <stdint.h>
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <memory>
-#include "base/hash.h"
#include "cc/cc_export.h"
-namespace base {
-class Value;
-namespace trace_event {
-class TracedValue;
-} // namespace trace_event
-} // namespace base
-
namespace cc {
// Element ids are chosen by cc's clients and can be used as a stable identifier
@@ -43,32 +36,20 @@ namespace cc {
// stable identifier for animation targets. A Layer's element id can change over
// the Layer's lifetime because non-default ElementIds are only set during an
// animation's lifetime.
+
+static const uint64_t kInvalidElementId = 0;
+
+// Non-test code in cc should never need to construct an ElementId with a newly
+// minted id.
struct CC_EXPORT ElementId {
- ElementId(int primaryId, int secondaryId)
- : primaryId(primaryId), secondaryId(secondaryId) {}
- ElementId() : ElementId(0, 0) {}
+ typedef uint64_t Id;
wkorman 2017/05/08 18:23:24 Can we use 'using' here instead?
+ Id id = kInvalidElementId;
bool operator==(const ElementId& o) const;
bool operator!=(const ElementId& o) const;
bool operator<(const ElementId& o) const;
- // An ElementId's conversion to a boolean value depends only on its primaryId.
explicit operator bool() const;
-
- void AddToTracedValue(base::trace_event::TracedValue* res) const;
- std::unique_ptr<base::Value> AsValue() const;
-
- // The compositor treats this as an opaque handle and should not know how to
- // interpret these bits. Non-blink cc clients typically operate in terms of
- // layers and may set this value to match the client's layer id.
- int primaryId;
- int secondaryId;
-};
-
-CC_EXPORT ElementId LayerIdToElementIdForTesting(int layer_id);
-
-struct CC_EXPORT ElementIdHash {
- size_t operator()(ElementId key) const;
};
// Stream operator so ElementId can be used in assertion statements.

Powered by Google App Engine
This is Rietveld 408576698