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

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

Issue 356953003: Adding DiskBasedCertCache to HttpCache (+UMA). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@current
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 DCHECK_EQ(WI_CREATE_BACKEND, op); 1167 DCHECK_EQ(WI_CREATE_BACKEND, op);
1168 1168
1169 // We don't need the callback anymore. 1169 // We don't need the callback anymore.
1170 pending_op->callback.Reset(); 1170 pending_op->callback.Reset();
1171 1171
1172 if (backend_factory_.get()) { 1172 if (backend_factory_.get()) {
1173 // We may end up calling OnBackendCreated multiple times if we have pending 1173 // We may end up calling OnBackendCreated multiple times if we have pending
1174 // work items. The first call saves the backend and releases the factory, 1174 // work items. The first call saves the backend and releases the factory,
1175 // and the last call clears building_backend_. 1175 // and the last call clears building_backend_.
1176 backend_factory_.reset(); // Reclaim memory. 1176 backend_factory_.reset(); // Reclaim memory.
1177 if (result == OK) 1177 if (result == OK) {
1178 disk_cache_ = pending_op->backend.Pass(); 1178 disk_cache_ = pending_op->backend.Pass();
1179 cert_cache_.reset(new DiskBasedCertCache(disk_cache_.get()));
1180 }
1179 } 1181 }
1180 1182
1181 if (!pending_op->pending_queue.empty()) { 1183 if (!pending_op->pending_queue.empty()) {
1182 WorkItem* pending_item = pending_op->pending_queue.front(); 1184 WorkItem* pending_item = pending_op->pending_queue.front();
1183 pending_op->pending_queue.pop_front(); 1185 pending_op->pending_queue.pop_front();
1184 DCHECK_EQ(WI_CREATE_BACKEND, pending_item->operation()); 1186 DCHECK_EQ(WI_CREATE_BACKEND, pending_item->operation());
1185 1187
1186 // We want to process a single callback at a time, because the cache may 1188 // We want to process a single callback at a time, because the cache may
1187 // go away from the callback. 1189 // go away from the callback.
1188 pending_op->writer = pending_item; 1190 pending_op->writer = pending_item;
1189 1191
1190 base::MessageLoop::current()->PostTask( 1192 base::MessageLoop::current()->PostTask(
1191 FROM_HERE, 1193 FROM_HERE,
1192 base::Bind(&HttpCache::OnBackendCreated, GetWeakPtr(), 1194 base::Bind(&HttpCache::OnBackendCreated, GetWeakPtr(),
1193 result, pending_op)); 1195 result, pending_op));
1194 } else { 1196 } else {
1195 building_backend_ = false; 1197 building_backend_ = false;
1196 DeletePendingOp(pending_op); 1198 DeletePendingOp(pending_op);
1197 } 1199 }
1198 1200
1199 // The cache may be gone when we return from the callback. 1201 // The cache may be gone when we return from the callback.
1200 if (!item->DoCallback(result, disk_cache_.get())) 1202 if (!item->DoCallback(result, disk_cache_.get()))
1201 item->NotifyTransaction(result, NULL); 1203 item->NotifyTransaction(result, NULL);
1202 } 1204 }
1203 1205
1204 } // namespace net 1206 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698