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

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

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implement in backend Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 } 456 }
457 457
458 void HttpCache::CloseAllConnections() { 458 void HttpCache::CloseAllConnections() {
459 net::HttpNetworkLayer* network = 459 net::HttpNetworkLayer* network =
460 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); 460 static_cast<net::HttpNetworkLayer*>(network_layer_.get());
461 HttpNetworkSession* session = network->GetSession(); 461 HttpNetworkSession* session = network->GetSession();
462 if (session) 462 if (session)
463 session->CloseAllConnections(); 463 session->CloseAllConnections();
464 } 464 }
465 465
466 void HttpCache::OnExternalCacheHit(const GURL& url,
467 const std::string& http_method) {
468 if (!disk_cache_.get())
469 return;
470
471 HttpRequestInfo request_info;
472 request_info.url = url;
473 request_info.method = http_method;
474 std::string key = GenerateCacheKey(&request_info);
475 disk_cache_->OnExternalCacheHit(key);
476 }
477
466 int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { 478 int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
467 // Do lazy initialization of disk cache if needed. 479 // Do lazy initialization of disk cache if needed.
468 if (!disk_cache_.get()) 480 if (!disk_cache_.get())
469 CreateBackend(NULL, NULL); // We don't care about the result. 481 CreateBackend(NULL, NULL); // We don't care about the result.
470 482
471 trans->reset(new HttpCache::Transaction(this)); 483 trans->reset(new HttpCache::Transaction(this));
472 return OK; 484 return OK;
473 } 485 }
474 486
475 HttpCache* HttpCache::GetCache() { 487 HttpCache* HttpCache::GetCache() {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 building_backend_ = false; 1145 building_backend_ = false;
1134 DeletePendingOp(pending_op); 1146 DeletePendingOp(pending_op);
1135 } 1147 }
1136 1148
1137 // The cache may be gone when we return from the callback. 1149 // The cache may be gone when we return from the callback.
1138 if (!item->DoCallback(result, backend)) 1150 if (!item->DoCallback(result, backend))
1139 item->NotifyTransaction(result, NULL); 1151 item->NotifyTransaction(result, NULL);
1140 } 1152 }
1141 1153
1142 } // namespace net 1154 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698