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

Unified Diff: cc/surfaces/surface_id.h

Issue 1496103002: Reusing base::IdType<...> to implement SurfaceId. Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-id-base
Patch Set: Rebasing + dusting off... Created 4 years, 10 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
« no previous file with comments | « cc/surfaces/surface_hittest_unittest.cc ('k') | cc/surfaces/surface_id_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_id.h
diff --git a/cc/surfaces/surface_id.h b/cc/surfaces/surface_id.h
index c0c4410d973f1512ce0268e5d0dd30429dc22edd..d257d02322de41bb7ffeb93ec09b2566daaac455 100644
--- a/cc/surfaces/surface_id.h
+++ b/cc/surfaces/surface_id.h
@@ -5,39 +5,12 @@
#ifndef CC_SURFACES_SURFACE_ID_H_
#define CC_SURFACES_SURFACE_ID_H_
-#include <stddef.h>
-#include <stdint.h>
-
-#include <functional>
+#include "base/id_type.h"
namespace cc {
-struct SurfaceId {
- SurfaceId() : id(0) {}
- explicit SurfaceId(uint64_t id) : id(id) {}
-
- bool is_null() const { return id == 0; }
-
- uint64_t id;
-};
-
-inline bool operator==(const SurfaceId& a, const SurfaceId& b) {
- return a.id == b.id;
-}
-
-inline bool operator!=(const SurfaceId& a, const SurfaceId& b) {
- return !(a == b);
-}
-
-inline bool operator<(const SurfaceId& a, const SurfaceId& b) {
- return a.id < b.id;
-}
-
-struct SurfaceIdHash {
- size_t operator()(const SurfaceId& key) const {
- return std::hash<uint64_t>()(key.id);
- }
-};
+class Surface;
+using SurfaceId = base::IdTypeU64<Surface>;
} // namespace cc
« no previous file with comments | « cc/surfaces/surface_hittest_unittest.cc ('k') | cc/surfaces/surface_id_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698