OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" | 5 #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "third_party/smhasher/src/MurmurHash2.h" | 9 #include "third_party/smhasher/src/MurmurHash2.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 : type(type) { | 21 : type(type) { |
22 DCHECK(base::IsValueInRangeForNumericType<int>(new_id.size())); | 22 DCHECK(base::IsValueInRangeForNumericType<int>(new_id.size())); |
23 if (!new_id.empty()) { | 23 if (!new_id.empty()) { |
24 id = MurmurHash64A(&new_id.front(), static_cast<int>(new_id.size()), | 24 id = MurmurHash64A(&new_id.front(), static_cast<int>(new_id.size()), |
25 kMurmur2HashSeed); | 25 kMurmur2HashSeed); |
26 } else { | 26 } else { |
27 id = 0; | 27 id = 0; |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
| 31 CoordinationUnitID::CoordinationUnitID(const CoordinationUnitType& type, |
| 32 uint64_t new_id) |
| 33 : id(new_id), type(type) {} |
| 34 |
31 } // resource_coordinator | 35 } // resource_coordinator |
OLD | NEW |