Chromium Code Reviews| Index: services/resource_coordinator/public/cpp/coordination_unit_id.cc |
| diff --git a/services/resource_coordinator/public/cpp/coordination_unit_id.cc b/services/resource_coordinator/public/cpp/coordination_unit_id.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3a66700b731b4527ad6ed7d958b9001f5ee0d14f |
| --- /dev/null |
| +++ b/services/resource_coordinator/public/cpp/coordination_unit_id.cc |
| @@ -0,0 +1,23 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "services/resource_coordinator/public/cpp/coordination_unit_id.h" |
| + |
| +#include "third_party/smhasher/src/MurmurHash2.h" |
| + |
| +namespace resource_coordinator { |
| + |
| +// The seed to use when taking the murmur2 hash of the id. |
| +const uint64_t kMurmur2HashSeed = 0; |
| + |
| +CoordinationUnitID::CoordinationUnitID() |
| + : id(0), type(CoordinationUnitType::INVALID_TYPE) {} |
| + |
| +CoordinationUnitID::CoordinationUnitID(const CoordinationUnitType& type, |
| + const std::string& new_id) |
| + : type(type) { |
| + id = MurmurHash2(&new_id.front(), new_id.size(), kMurmur2HashSeed); |
|
Primiano Tucci (use gerrit)
2017/04/11 18:04:51
if you initialize this in the initializer list ou
oystein (OOO til 10th of July)
2017/04/12 19:15:31
Doesn't work with the Mojo serialization/deseriali
|
| +} |
| + |
| +} // resource_coordinator |