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

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

Issue 1830543003: Using STL to implement functionality in input_method_util.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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_util.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index 97971601d00109f31cc9f2091f85829bdd351d2a..432653aadf8ddbae35de4bc45c3b0c8b9d902848 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -690,12 +690,8 @@ bool InputMethodUtil::MigrateInputMethods(
}
if (rewritten) {
// Removes the duplicates.
- std::vector<std::string> new_ids;
- for (size_t i = 0; i < ids.size(); ++i) {
- if (std::find(new_ids.begin(), new_ids.end(), ids[i]) == new_ids.end())
- new_ids.push_back(ids[i]);
- }
- ids.swap(new_ids);
+ std::sort(ids.begin(), ids.end());
Shu Chen 2016/03/24 13:05:31 The sort() here is risky since the order of the in
chakshu 2016/04/04 05:28:32 Okay, I was not aware that the order of input meth
Shu Chen 2016/04/04 12:48:15 I'm not sure whether std::unique can do the thing.
chakshu 2016/04/11 06:54:37 Done ! Also if you want it to be done in-place wit
+ ids.erase(std::unique(ids.begin(), ids.end()), ids.end());
}
return rewritten;
}
« no previous file with comments | « no previous file | chrome/browser/spellchecker/spellcheck_service.cc » ('j') | chrome/browser/spellchecker/spellcheck_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698