OLD | NEW |
---|---|
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 HttpCache* HttpCache::GetCache() { | 460 HttpCache* HttpCache::GetCache() { |
461 return this; | 461 return this; |
462 } | 462 } |
463 | 463 |
464 HttpNetworkSession* HttpCache::GetSession() { | 464 HttpNetworkSession* HttpCache::GetSession() { |
465 net::HttpNetworkLayer* network = | 465 net::HttpNetworkLayer* network = |
466 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 466 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
467 return network->GetSession(); | 467 return network->GetSession(); |
468 } | 468 } |
469 | 469 |
470 scoped_ptr<HttpTransactionFactory> HttpCache::SetNetworkLayerForTesting( | |
471 scoped_ptr<HttpTransactionFactory> new_network_layer) { | |
mmenke
2014/01/23 20:40:52
Suggest calling this "SetHttpNetworkTransactionFac
Randy Smith (Not in Mondays)
2014/01/25 21:11:31
Done.
| |
472 scoped_ptr<HttpTransactionFactory> old_network_layer(network_layer_.Pass()); | |
473 network_layer_ = new_network_layer.Pass(); | |
474 return old_network_layer.Pass(); | |
475 } | |
476 | |
470 //----------------------------------------------------------------------------- | 477 //----------------------------------------------------------------------------- |
471 | 478 |
472 int HttpCache::CreateBackend(disk_cache::Backend** backend, | 479 int HttpCache::CreateBackend(disk_cache::Backend** backend, |
473 const net::CompletionCallback& callback) { | 480 const net::CompletionCallback& callback) { |
474 if (!backend_factory_.get()) | 481 if (!backend_factory_.get()) |
475 return ERR_FAILED; | 482 return ERR_FAILED; |
476 | 483 |
477 building_backend_ = true; | 484 building_backend_ = true; |
478 | 485 |
479 scoped_ptr<WorkItem> item(new WorkItem(WI_CREATE_BACKEND, NULL, callback, | 486 scoped_ptr<WorkItem> item(new WorkItem(WI_CREATE_BACKEND, NULL, callback, |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1165 building_backend_ = false; | 1172 building_backend_ = false; |
1166 DeletePendingOp(pending_op); | 1173 DeletePendingOp(pending_op); |
1167 } | 1174 } |
1168 | 1175 |
1169 // The cache may be gone when we return from the callback. | 1176 // The cache may be gone when we return from the callback. |
1170 if (!item->DoCallback(result, disk_cache_.get())) | 1177 if (!item->DoCallback(result, disk_cache_.get())) |
1171 item->NotifyTransaction(result, NULL); | 1178 item->NotifyTransaction(result, NULL); |
1172 } | 1179 } |
1173 | 1180 |
1174 } // namespace net | 1181 } // namespace net |
OLD | NEW |