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

Side by Side Diff: net/extras/sqlite/sqlite_channel_id_store.cc

Issue 2943703002: Use ContainsValue() instead of std::find() in net/ (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « net/dns/host_resolver_impl_unittest.cc ('k') | net/http/http_security_headers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/extras/sqlite/sqlite_channel_id_store.h" 5 #include "net/extras/sqlite/sqlite_channel_id_store.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
19 #include "base/sequenced_task_runner.h" 19 #include "base/sequenced_task_runner.h"
20 #include "base/stl_util.h"
20 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
21 #include "crypto/ec_private_key.h" 22 #include "crypto/ec_private_key.h"
22 #include "net/cert/asn1_util.h" 23 #include "net/cert/asn1_util.h"
23 #include "net/cert/x509_certificate.h" 24 #include "net/cert/x509_certificate.h"
24 #include "net/cookies/cookie_util.h" 25 #include "net/cookies/cookie_util.h"
25 #include "net/ssl/channel_id_service.h" 26 #include "net/ssl/channel_id_service.h"
26 #include "net/ssl/ssl_client_cert_type.h" 27 #include "net/ssl/ssl_client_cert_type.h"
27 #include "sql/error_delegate_util.h" 28 #include "sql/error_delegate_util.h"
28 #include "sql/meta_table.h" 29 #include "sql/meta_table.h"
29 #include "sql/statement.h" 30 #include "sql/statement.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 520 }
520 } 521 }
521 522
522 void SQLiteChannelIDStore::Backend::PrunePendingOperationsForDeletes( 523 void SQLiteChannelIDStore::Backend::PrunePendingOperationsForDeletes(
523 const std::list<std::string>& server_identifiers) { 524 const std::list<std::string>& server_identifiers) {
524 DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); 525 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
525 base::AutoLock locked(lock_); 526 base::AutoLock locked(lock_);
526 527
527 for (PendingOperationsList::iterator it = pending_.begin(); 528 for (PendingOperationsList::iterator it = pending_.begin();
528 it != pending_.end();) { 529 it != pending_.end();) {
529 bool remove = 530 if (base::ContainsValue(server_identifiers,
530 std::find(server_identifiers.begin(), server_identifiers.end(), 531 (*it)->channel_id().server_identifier())) {
531 (*it)->channel_id().server_identifier()) !=
532 server_identifiers.end();
533
534 if (remove) {
535 std::unique_ptr<PendingOperation> po(*it); 532 std::unique_ptr<PendingOperation> po(*it);
536 it = pending_.erase(it); 533 it = pending_.erase(it);
537 --num_pending_; 534 --num_pending_;
538 } else { 535 } else {
539 ++it; 536 ++it;
540 } 537 }
541 } 538 }
542 } 539 }
543 540
544 void SQLiteChannelIDStore::Backend::Flush() { 541 void SQLiteChannelIDStore::Backend::Flush() {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 backend_->Flush(); 696 backend_->Flush();
700 } 697 }
701 698
702 SQLiteChannelIDStore::~SQLiteChannelIDStore() { 699 SQLiteChannelIDStore::~SQLiteChannelIDStore() {
703 backend_->Close(); 700 backend_->Close();
704 // We release our reference to the Backend, though it will probably still have 701 // We release our reference to the Backend, though it will probably still have
705 // a reference if the background task runner has not run Close() yet. 702 // a reference if the background task runner has not run Close() yet.
706 } 703 }
707 704
708 } // namespace net 705 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/host_resolver_impl_unittest.cc ('k') | net/http/http_security_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698