Index: chrome_elf/dll_hash/dll_hash.cc |
diff --git a/chrome_elf/dll_hash/dll_hash.cc b/chrome_elf/dll_hash/dll_hash.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f9c1dd81d25dd6d9cb790b1a32fbeeaa94161703 |
--- /dev/null |
+++ b/chrome_elf/dll_hash/dll_hash.cc |
@@ -0,0 +1,14 @@ |
+// Copyright (c) 2014 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 "base/hash.h" |
+#include "chrome_elf/dll_hash/dll_hash.h" |
+ |
+int DllNameToHash(std::string dll_name) { |
+ uint32 data = base::Hash(dll_name); |
+ |
+ // Strip off the signed bit because UMA doesn't support negative values, |
+ // but takes a signed int as input. |
+ return static_cast<int>(data & 0x7fffffff); |
+} |