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

Unified Diff: services/resource_coordinator/public/cpp/coordination_unit_id.h

Issue 2892443002: [GRC] Process Coordination Unit support for Global Resource Controller (Closed)
Patch Set: Rebase 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: services/resource_coordinator/public/cpp/coordination_unit_id.h
diff --git a/services/resource_coordinator/public/cpp/coordination_unit_id.h b/services/resource_coordinator/public/cpp/coordination_unit_id.h
index 71e9612ea0e88853ccd728f16572f82bb7cab5a0..a14579993f786d97c831821e88144176493bff22 100644
--- a/services/resource_coordinator/public/cpp/coordination_unit_id.h
+++ b/services/resource_coordinator/public/cpp/coordination_unit_id.h
@@ -14,16 +14,22 @@ namespace resource_coordinator {
// This is a native struct rather than a mojom struct as we eventually want
// to annotate base::TaskRunner with CUs for cost attribution purses and
// would like to move it to base/ as easily as possible at that point.
+// TODO(oysteine): Rename to CoordinationUnitGUID to better differentiate the
+// class from the internal id
struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT CoordinationUnitID {
+ typedef uint64_t CoordinationUnitTypeId;
+
CoordinationUnitID();
CoordinationUnitID(const CoordinationUnitType& type,
const std::string& new_id);
+ CoordinationUnitID(const CoordinationUnitType& type,
+ CoordinationUnitTypeId new_id);
bool operator==(const CoordinationUnitID& b) const {
return id == b.id && type == b.type;
}
- int64_t id;
+ CoordinationUnitTypeId id;
CoordinationUnitType type;
};
@@ -35,7 +41,8 @@ template <>
struct hash<resource_coordinator::CoordinationUnitID> {
uint64_t operator()(
const resource_coordinator::CoordinationUnitID& id) const {
- return ((static_cast<uint64_t>(id.type)) << 32) | id.id;
+ return ((static_cast<uint64_t>(id.type)) << 32) |
+ static_cast<uint64_t>(id.id);
}
};

Powered by Google App Engine
This is Rietveld 408576698