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

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: Updated as per latest code Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11f396171916c3e52859310a4a2bfc9fb55b942e..ba721371857a5fa25bd6e3974f3c519710976d0d 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -10,6 +10,7 @@
#include <functional>
#include <map>
#include <memory>
+#include <unordered_set>
#include <utility>
#include "base/macros.h"
@@ -687,9 +688,11 @@ bool InputMethodUtil::MigrateInputMethods(
if (rewritten) {
// Removes the duplicates.
std::vector<std::string> new_ids;
+ std::unordered_set<std::string> ids_set;
for (size_t i = 0; i < ids.size(); ++i) {
- if (std::find(new_ids.begin(), new_ids.end(), ids[i]) == new_ids.end())
+ if (ids_set.find(ids[i]) == ids_set.end())
new_ids.push_back(ids[i]);
+ ids_set.insert(ids[i]);
}
ids.swap(new_ids);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698