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

Side by Side Diff: net/http/disk_based_cert_cache.cc

Issue 983223004: base: Remove non-const refs from the MRUCache implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/http/disk_based_cert_cache.h" 5 #include "net/http/disk_based_cert_cache.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 void DiskBasedCertCache::ReadWorker::RunCallbacks() { 493 void DiskBasedCertCache::ReadWorker::RunCallbacks() {
494 for (std::vector<GetCallback>::const_iterator it = user_callbacks_.begin(); 494 for (std::vector<GetCallback>::const_iterator it = user_callbacks_.begin();
495 it != user_callbacks_.end(); 495 it != user_callbacks_.end();
496 ++it) { 496 ++it) {
497 it->Run(cert_handle_); 497 it->Run(cert_handle_);
498 } 498 }
499 user_callbacks_.clear(); 499 user_callbacks_.clear();
500 } 500 }
501 501
502 void DiskBasedCertCache::CertFree::operator()( 502 void DiskBasedCertCache::CertFree::operator()(
503 X509Certificate::OSCertHandle cert_handle) { 503 X509Certificate::OSCertHandle* cert_handle) {
504 X509Certificate::FreeOSCertHandle(cert_handle); 504 X509Certificate::FreeOSCertHandle(*cert_handle);
505 } 505 }
506 506
507 DiskBasedCertCache::DiskBasedCertCache(disk_cache::Backend* backend) 507 DiskBasedCertCache::DiskBasedCertCache(disk_cache::Backend* backend)
508 : backend_(backend), 508 : backend_(backend),
509 mru_cert_cache_(kMemoryCacheMaxSize), 509 mru_cert_cache_(kMemoryCacheMaxSize),
510 mem_cache_hits_(0), 510 mem_cache_hits_(0),
511 mem_cache_misses_(0), 511 mem_cache_misses_(0),
512 weak_factory_(this) { 512 weak_factory_(this) {
513 DCHECK(backend_); 513 DCHECK(backend_);
514 } 514 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 595
596 void DiskBasedCertCache::FinishedWriteOperation( 596 void DiskBasedCertCache::FinishedWriteOperation(
597 const std::string& key, 597 const std::string& key,
598 X509Certificate::OSCertHandle cert_handle) { 598 X509Certificate::OSCertHandle cert_handle) {
599 write_worker_map_.erase(key); 599 write_worker_map_.erase(key);
600 if (!key.empty()) 600 if (!key.empty())
601 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); 601 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle));
602 } 602 }
603 603
604 } // namespace net 604 } // namespace net
OLDNEW
« base/containers/mru_cache.h ('K') | « net/http/disk_based_cert_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698