| 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);
|
|
|