| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |