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

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

Issue 138513002: Plumb network stack information about existence of cached copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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) 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 HttpCache* HttpCache::GetCache() { 435 HttpCache* HttpCache::GetCache() {
436 return this; 436 return this;
437 } 437 }
438 438
439 HttpNetworkSession* HttpCache::GetSession() { 439 HttpNetworkSession* HttpCache::GetSession() {
440 net::HttpNetworkLayer* network = 440 net::HttpNetworkLayer* network =
441 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); 441 static_cast<net::HttpNetworkLayer*>(network_layer_.get());
442 return network->GetSession(); 442 return network->GetSession();
443 } 443 }
444 444
445 scoped_ptr<HttpTransactionFactory> HttpCache::SetNetworkLayerForTesting(
446 scoped_ptr<HttpTransactionFactory> new_network_layer) {
447 scoped_ptr<HttpTransactionFactory> old_network_layer(network_layer_.Pass());
448 network_layer_ = new_network_layer.Pass();
449 return old_network_layer.Pass();
450 }
451
445 //----------------------------------------------------------------------------- 452 //-----------------------------------------------------------------------------
446 453
447 int HttpCache::CreateBackend(disk_cache::Backend** backend, 454 int HttpCache::CreateBackend(disk_cache::Backend** backend,
448 const net::CompletionCallback& callback) { 455 const net::CompletionCallback& callback) {
449 if (!backend_factory_.get()) 456 if (!backend_factory_.get())
450 return ERR_FAILED; 457 return ERR_FAILED;
451 458
452 building_backend_ = true; 459 building_backend_ = true;
453 460
454 scoped_ptr<WorkItem> item(new WorkItem(WI_CREATE_BACKEND, NULL, callback, 461 scoped_ptr<WorkItem> item(new WorkItem(WI_CREATE_BACKEND, NULL, callback,
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 building_backend_ = false; 1147 building_backend_ = false;
1141 DeletePendingOp(pending_op); 1148 DeletePendingOp(pending_op);
1142 } 1149 }
1143 1150
1144 // The cache may be gone when we return from the callback. 1151 // The cache may be gone when we return from the callback.
1145 if (!item->DoCallback(result, disk_cache_.get())) 1152 if (!item->DoCallback(result, disk_cache_.get()))
1146 item->NotifyTransaction(result, NULL); 1153 item->NotifyTransaction(result, NULL);
1147 } 1154 }
1148 1155
1149 } // namespace net 1156 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698