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

Unified Diff: chrome/browser/spellchecker/spellcheck_custom_dictionary.cc

Issue 22460011: [CleanUp] Use base::STLSetDifference in place of std::set_difference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing head file. Created 7 years, 4 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 | « chrome/browser/spellchecker/feedback_sender.cc ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
index c5c8163b0e8bdfc9bf9ee053ad29979db3a7aaf5..4872b4ead81c957bc25093021d751493ae093128 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -129,12 +129,7 @@ void SaveDictionaryFileReliably(
int SanitizeWordsToAdd(const WordSet& existing, WordList& to_add) {
// Do not add duplicate words.
std::sort(to_add.begin(), to_add.end());
- WordList new_words;
- std::set_difference(to_add.begin(),
- to_add.end(),
- existing.begin(),
- existing.end(),
- std::back_inserter(new_words));
+ WordList new_words = base::STLSetDifference<WordList>(to_add, existing);
new_words.erase(std::unique(new_words.begin(), new_words.end()),
new_words.end());
int result = VALID_CHANGE;
@@ -328,12 +323,8 @@ syncer::SyncMergeResult SpellcheckCustomDictionary::MergeDataAndStartSyncing(
// Add as many as possible local words remotely.
std::sort(to_add_locally.begin(), to_add_locally.end());
- WordList to_add_remotely;
- std::set_difference(words_.begin(),
- words_.end(),
- to_add_locally.begin(),
- to_add_locally.end(),
- std::back_inserter(to_add_remotely));
+ WordList to_add_remotely = base::STLSetDifference<WordList>(words_,
+ to_add_locally);
// Send local changes to the sync server.
Change to_change_remotely(to_add_remotely);
@@ -431,12 +422,9 @@ void SpellcheckCustomDictionary::UpdateDictionaryFile(
// Remove words.
std::sort(custom_words.begin(), custom_words.end());
- WordList remaining;
- std::set_difference(custom_words.begin(),
- custom_words.end(),
- dictionary_change.to_remove().begin(),
- dictionary_change.to_remove().end(),
- std::back_inserter(remaining));
+ WordList remaining =
+ base::STLSetDifference<WordList>(custom_words,
+ dictionary_change.to_remove());
std::swap(custom_words, remaining);
SaveDictionaryFileReliably(custom_words, path);
« no previous file with comments | « chrome/browser/spellchecker/feedback_sender.cc ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698