Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
index bff428cf90affa2c97936a29952c3c3809a76663..accbbccae08c41ab9181614ff55811917a12ebcb 100644 |
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
@@ -10,6 +10,7 @@ |
#include "base/basictypes.h" |
#include "base/bind.h" |
+#include "base/hash.h" |
#include "base/location.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/metrics/histogram.h" |
@@ -863,22 +864,11 @@ InputMethodManagerImpl::InputMethodManagerImpl( |
util_.ResetInputMethods(descriptors); |
// Initializes the stat id map. |
- std::map<int, std::vector<std::string> > buckets; |
for (InputMethodDescriptors::const_iterator it = descriptors.begin(); |
it != descriptors.end(); ++it) { |
- char first_char; |
- int cat_id = static_cast<int>( |
- GetInputMethodCategory(it->id(), &first_char)); |
- int key = cat_id * 1000 + first_char; |
- buckets[key].push_back(it->id()); |
- } |
- for (std::map<int, std::vector<std::string>>::iterator i = |
- buckets.begin(); i != buckets.end(); ++i) { |
- std::sort(i->second.begin(), i->second.end()); |
- for (size_t j = 0; j < i->second.size() && j < 100; ++j) { |
- int key = i->first * 100 + j; |
- stat_id_map_[i->second[j]] = key; |
- } |
+ std::string id = it->id(); |
+ stat_id_map_[id] = |
+ static_cast<int>(base::SuperFastHash(id.c_str(), id.length())); |
Ilya Sherman
2015/07/17 01:43:58
nit: Rather than static_cast<int>, please use base
Ilya Sherman
2015/07/17 01:43:58
Do you actually need this map anymore? I think yo
Ilya Sherman
2015/07/17 01:43:58
nit: Any reason not to call this as "base::Hash(id
Shu Chen
2015/07/17 03:55:50
There will be compiling errors as below. I want to
Shu Chen
2015/07/17 03:55:50
Done.
Shu Chen
2015/07/17 03:55:50
The reason was simply because I'd like it be super
|
} |
} |
@@ -892,8 +882,7 @@ void InputMethodManagerImpl::RecordInputMethodUsage( |
UMA_HISTOGRAM_ENUMERATION("InputMethod.Category", |
GetInputMethodCategory(input_method_id), |
INPUT_METHOD_CATEGORY_MAX); |
- UMA_HISTOGRAM_SPARSE_SLOWLY("InputMethod.ID", |
- stat_id_map_[input_method_id]); |
+ UMA_HISTOGRAM_SPARSE_SLOWLY("InputMethod.ID2", stat_id_map_[input_method_id]); |
} |
void InputMethodManagerImpl::AddObserver( |