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

Side by Side Diff: services/resource_coordinator/public/cpp/coordination_unit_id.h

Issue 2798713002: Global Resource Coordinator: Basic service internals (Closed)
Patch Set: Review fixes Created 3 years, 8 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_ID_H_
5 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_ID_H_
6
7 #include <string>
8
9 #include "services/resource_coordinator/public/cpp/coordination_unit_types.h"
10
11 namespace resource_coordinator {
12
13 struct CoordinationUnitID {
14 CoordinationUnitID();
15 CoordinationUnitID(const CoordinationUnitType& type, const std::string& id);
16
17 bool operator==(const CoordinationUnitID& b) const {
18 return id == b.id && type == b.type;
19 }
20
21 uint64_t operator()(const CoordinationUnitID& id) const;
Primiano Tucci (use gerrit) 2017/04/11 18:04:51 this one doesn't seem to be defined in the .cc fil
oystein (OOO til 10th of July) 2017/04/12 19:15:31 Yep, done.
22
23 int32_t id;
24 CoordinationUnitType type;
25 };
26
27 } // resource_coordinator
28
29 template <>
30 struct std::hash<resource_coordinator::CoordinationUnitID> {
31 uint64_t operator()(
32 const resource_coordinator::CoordinationUnitID& id) const {
33 return ((static_cast<uint64_t>(id.type)) << 32) | id.id;
34 }
35 };
36
37 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698