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

Unified Diff: gpu/command_buffer/common/id_type.h

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Rebasing... 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 | « gpu/command_buffer/common/command_buffer_id.h ('k') | gpu/command_buffer/common/id_type_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/id_type.h
diff --git a/content/common/id_type.h b/gpu/command_buffer/common/id_type.h
similarity index 94%
rename from content/common/id_type.h
rename to gpu/command_buffer/common/id_type.h
index 5e1c45353acf3ea642b8ebba92c54509020d3511..197736451a1fa85607839413db9a2c31d9fd5408 100644
--- a/content/common/id_type.h
+++ b/gpu/command_buffer/common/id_type.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_ID_TYPE_H_
-#define CONTENT_COMMON_ID_TYPE_H_
+#ifndef GPU_COMMAND_BUFFER_COMMON_ID_TYPE_H_
+#define GPU_COMMAND_BUFFER_COMMON_ID_TYPE_H_
#include <stdint.h>
#include <cstddef>
@@ -28,13 +28,14 @@
// IdType32<T> / IdTypeU32<T>: Signed / unsigned 32-bit IDs
// IdType64<T> / IdTypeU64<T>: Signed / unsigned 64-bit IDs
// IdType<>: For when you need a different underlying type or
-// a default/invalid value other than zero.
+// a default/null value other than zero.
//
// IdType32<Foo> behaves just like an int32_t in the following aspects:
// - it can be used as a key in std::map and/or std::unordered_map;
// - it can be used as an argument to DCHECK_EQ or streamed to LOG(ERROR);
// - it has the same memory footprint and runtime overhead as int32_t;
// - it can be copied by memcpy.
+// - it can be used in IPC messages (for now via gpu/ipc/id_type_traits.h)
//
// IdType32<Foo> has the following differences from a bare int32_t:
// - it forces coercions to go through GetUnsafeValue and FromUnsafeValue;
@@ -42,7 +43,7 @@
// - it ensures initialization to zero and allows checking against
// default-initialized values via is_null method.
-namespace content {
+namespace gpu {
template <typename TypeMarker, typename WrappedType, WrappedType kInvalidValue>
class IdType {
@@ -102,6 +103,6 @@ std::ostream& operator<<(
return stream << id.GetUnsafeValue();
}
-} // namespace content
+} // namespace gpu
#endif // CONTENT_COMMON_ID_TYPE_H_
« no previous file with comments | « gpu/command_buffer/common/command_buffer_id.h ('k') | gpu/command_buffer/common/id_type_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698