Index: net/http/http_cache.cc |
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc |
index aa6fc228bc6c91b7cbf31c3fa67145683466695f..be7ea7caf823a3ee39bf48ed5259d2296b70d236 100644 |
--- a/net/http/http_cache.cc |
+++ b/net/http/http_cache.cc |
@@ -33,6 +33,7 @@ |
#include "net/base/net_errors.h" |
#include "net/base/upload_data_stream.h" |
#include "net/disk_cache/disk_cache.h" |
+#include "net/http/disk_based_cert_cache.h" |
#include "net/http/disk_cache_based_quic_server_info.h" |
#include "net/http/http_cache_transaction.h" |
#include "net/http/http_network_layer.h" |
@@ -45,6 +46,11 @@ |
namespace { |
+bool UseCertCache() { |
+ return base::FieldTrialList::FindFullName("CertCacheTrial") == |
+ "ExperimentGroup"; |
+} |
+ |
// Adaptor to delete a file on a worker thread. |
void DeletePath(base::FilePath path) { |
base::DeleteFile(path, false); |
@@ -346,6 +352,7 @@ HttpCache::~HttpCache() { |
// Before deleting pending_ops_, we have to make sure that the disk cache is |
// done with said operations, or it will attempt to use deleted data. |
+ cert_cache_.reset(); |
disk_cache_.reset(); |
PendingOpsMap::iterator pending_it = pending_ops_.begin(); |
@@ -1174,8 +1181,11 @@ void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { |
// work items. The first call saves the backend and releases the factory, |
// and the last call clears building_backend_. |
backend_factory_.reset(); // Reclaim memory. |
- if (result == OK) |
+ if (result == OK) { |
disk_cache_ = pending_op->backend.Pass(); |
+ if (UseCertCache()) |
+ cert_cache_.reset(new DiskBasedCertCache(disk_cache_.get())); |
+ } |
} |
if (!pending_op->pending_queue.empty()) { |