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

Side by Side Diff: chrome/browser/spellchecker/feedback_sender.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // The |FeedbackSender| object stores the user feedback to spellcheck 5 // The |FeedbackSender| object stores the user feedback to spellcheck
6 // suggestions in a |Feedback| object. 6 // suggestions in a |Feedback| object.
7 // 7 //
8 // When spelling service returns spellcheck results, these results first arrive 8 // When spelling service returns spellcheck results, these results first arrive
9 // in |FeedbackSender| to assign hash identifiers for each 9 // in |FeedbackSender| to assign hash identifiers for each
10 // misspelling-suggestion pair. If the spelling service identifies the same 10 // misspelling-suggestion pair. If the spelling service identifies the same
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 !it.IsAtEnd(); 338 !it.IsAtEnd();
339 it.Advance()) { 339 it.Advance()) {
340 alive_renderers.insert(it.GetCurrentValue()->GetID()); 340 alive_renderers.insert(it.GetCurrentValue()->GetID());
341 it.GetCurrentValue()->Send(new SpellCheckMsg_RequestDocumentMarkers()); 341 it.GetCurrentValue()->Send(new SpellCheckMsg_RequestDocumentMarkers());
342 } 342 }
343 343
344 // Asynchronously send out the feedback for all the renderers that are no 344 // Asynchronously send out the feedback for all the renderers that are no
345 // longer alive. 345 // longer alive.
346 std::vector<int> known_renderers = feedback_.GetRendersWithMisspellings(); 346 std::vector<int> known_renderers = feedback_.GetRendersWithMisspellings();
347 std::sort(known_renderers.begin(), known_renderers.end()); 347 std::sort(known_renderers.begin(), known_renderers.end());
348 std::vector<int> dead_renderers; 348 std::vector<int> dead_renderers =
349 std::set_difference(known_renderers.begin(), 349 base::STLSetDifference<std::vector<int> >(known_renderers,
350 known_renderers.end(), 350 alive_renderers);
351 alive_renderers.begin(),
352 alive_renderers.end(),
353 std::back_inserter(dead_renderers));
354 for (std::vector<int>::const_iterator it = dead_renderers.begin(); 351 for (std::vector<int>::const_iterator it = dead_renderers.begin();
355 it != dead_renderers.end(); 352 it != dead_renderers.end();
356 ++it) { 353 ++it) {
357 base::MessageLoop::current()->PostTask( 354 base::MessageLoop::current()->PostTask(
358 FROM_HERE, 355 FROM_HERE,
359 base::Bind(&FeedbackSender::OnReceiveDocumentMarkers, 356 base::Bind(&FeedbackSender::OnReceiveDocumentMarkers,
360 AsWeakPtr(), 357 AsWeakPtr(),
361 *it, 358 *it,
362 std::vector<uint32>())); 359 std::vector<uint32>()));
363 } 360 }
(...skipping 30 matching lines...) Expand all
394 senders_.push_back(sender); 391 senders_.push_back(sender);
395 392
396 // Request context is NULL in testing. 393 // Request context is NULL in testing.
397 if (request_context_.get()) { 394 if (request_context_.get()) {
398 sender->SetRequestContext(request_context_.get()); 395 sender->SetRequestContext(request_context_.get());
399 sender->Start(); 396 sender->Start();
400 } 397 }
401 } 398 }
402 399
403 } // namespace spellcheck 400 } // namespace spellcheck
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/feedback.cc ('k') | chrome/browser/spellchecker/spellcheck_custom_dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698