| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 MetadataWriter* writer = new MetadataWriter(trans); | 364 MetadataWriter* writer = new MetadataWriter(trans); |
| 365 | 365 |
| 366 // The writer will self destruct when done. | 366 // The writer will self destruct when done. |
| 367 writer->Write(url, expected_response_time, buf, buf_len); | 367 writer->Write(url, expected_response_time, buf, buf_len); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void HttpCache::CloseCurrentConnections() { | 370 void HttpCache::CloseCurrentConnections() { |
| 371 net::HttpNetworkLayer* network = | 371 net::HttpNetworkLayer* network = |
| 372 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 372 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
| 373 HttpNetworkSession* session = network->GetSession(); | 373 HttpNetworkSession* session = network->GetSession(); |
| 374 if (session) | 374 if (session) { |
| 375 session->Flush(); | 375 session->tcp_socket_pool()->CloseIdleSockets(); |
| 376 if (session->spdy_session_pool()) |
| 377 session->spdy_session_pool()->CloseAllSessions(); |
| 378 session->ReplaceTCPSocketPool(); |
| 379 } |
| 376 } | 380 } |
| 377 | 381 |
| 378 //----------------------------------------------------------------------------- | 382 //----------------------------------------------------------------------------- |
| 379 | 383 |
| 380 // Generate a key that can be used inside the cache. | 384 // Generate a key that can be used inside the cache. |
| 381 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { | 385 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { |
| 382 // Strip out the reference, username, and password sections of the URL. | 386 // Strip out the reference, username, and password sections of the URL. |
| 383 std::string url = HttpUtil::SpecForRequest(request->url); | 387 std::string url = HttpUtil::SpecForRequest(request->url); |
| 384 | 388 |
| 385 DCHECK(mode_ != DISABLE); | 389 DCHECK(mode_ != DISABLE); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 item->NotifyTransaction(ERR_CACHE_RACE, NULL); | 902 item->NotifyTransaction(ERR_CACHE_RACE, NULL); |
| 899 fail_requests = true; | 903 fail_requests = true; |
| 900 } else { | 904 } else { |
| 901 item->NotifyTransaction(result, entry); | 905 item->NotifyTransaction(result, entry); |
| 902 } | 906 } |
| 903 } | 907 } |
| 904 } | 908 } |
| 905 } | 909 } |
| 906 | 910 |
| 907 } // namespace net | 911 } // namespace net |
| OLD | NEW |