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

Unified Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 1237493003: Uses Hash values for sparse histograms for InputMethod.ID statistics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
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 89a42bb9f62bfe03c992f79f9cb25d8587a1bcba..7326e5ea89266c46107eab3b6a0823bbad6aac31 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"
@@ -862,25 +863,6 @@ InputMethodManagerImpl::InputMethodManagerImpl(
const InputMethodDescriptors& descriptors =
component_extension_ime_manager_->GetAllIMEAsInputMethodDescriptor();
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;
- }
- }
}
InputMethodManagerImpl::~InputMethodManagerImpl() {
@@ -893,8 +875,8 @@ 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", static_cast<int32_t>(base::Hash(input_method_id)));
}
void InputMethodManagerImpl::AddObserver(
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_manager_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698