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

Unified Diff: components/spellcheck/renderer/spellcheck.cc

Issue 2658013002: Remove ScopedVector in components/spellcheck (Closed)
Patch Set: code rebase Created 3 years, 10 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: components/spellcheck/renderer/spellcheck.cc
diff --git a/components/spellcheck/renderer/spellcheck.cc b/components/spellcheck/renderer/spellcheck.cc
index 5ff06a25adfad656be0f3c5164f03baf3c97cdcd..2e3eed58a63a78b049900d13a11b0389d501e577 100644
--- a/components/spellcheck/renderer/spellcheck.cc
+++ b/components/spellcheck/renderer/spellcheck.cc
@@ -263,7 +263,7 @@ void SpellCheck::OnRequestDocumentMarkers() {
// AddSpellcheckLanguage() is called.
void SpellCheck::AddSpellcheckLanguage(base::File file,
const std::string& language) {
- languages_.push_back(new SpellcheckLanguage());
+ languages_.push_back(base::MakeUnique<SpellcheckLanguage>());
languages_.back()->Init(std::move(file), language);
}
@@ -307,9 +307,7 @@ bool SpellCheck::SpellCheckWord(
*misspelling_len = 0;
suggestions_list.clear();
- for (ScopedVector<SpellcheckLanguage>::iterator language =
- languages_.begin();
- language != languages_.end();) {
+ for (auto language = languages_.begin(); language != languages_.end();) {
language_suggestions.clear();
SpellcheckLanguage::SpellcheckWordResult result =
(*language)->SpellCheckWord(
@@ -439,7 +437,7 @@ bool SpellCheck::InitializeIfNeeded() {
return true;
bool initialize_if_needed = false;
- for (SpellcheckLanguage* language : languages_)
+ for (auto& language : languages_)
initialize_if_needed |= language->InitializeIfNeeded();
return initialize_if_needed;
@@ -464,7 +462,7 @@ void SpellCheck::PerformSpellCheck(SpellcheckRequest* param) {
if (languages_.empty() ||
std::find_if(languages_.begin(), languages_.end(),
- [](SpellcheckLanguage* language) {
+ [](std::unique_ptr<SpellcheckLanguage>& language) {
return !language->IsEnabled();
}) != languages_.end()) {
param->completion()->didCancelCheckingText();
« no previous file with comments | « components/spellcheck/renderer/spellcheck.h ('k') | components/spellcheck/renderer/spellcheck_provider_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698