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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 MetadataWriter* writer = new MetadataWriter(trans); | 370 MetadataWriter* writer = new MetadataWriter(trans); |
371 | 371 |
372 // The writer will self destruct when done. | 372 // The writer will self destruct when done. |
373 writer->Write(url, expected_response_time, buf, buf_len); | 373 writer->Write(url, expected_response_time, buf, buf_len); |
374 } | 374 } |
375 | 375 |
376 void HttpCache::CloseCurrentConnections() { | 376 void HttpCache::CloseCurrentConnections() { |
377 net::HttpNetworkLayer* network = | 377 net::HttpNetworkLayer* network = |
378 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 378 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
379 HttpNetworkSession* session = network->GetSession(); | 379 HttpNetworkSession* session = network->GetSession(); |
380 if (session) { | 380 if (session) |
381 session->tcp_socket_pool()->CloseIdleSockets(); | 381 session->Flush(); |
382 if (session->spdy_session_pool()) | |
383 session->spdy_session_pool()->CloseAllSessions(); | |
384 session->ReplaceTCPSocketPool(); | |
385 } | |
386 } | 382 } |
387 | 383 |
388 //----------------------------------------------------------------------------- | 384 //----------------------------------------------------------------------------- |
389 | 385 |
390 // Generate a key that can be used inside the cache. | 386 // Generate a key that can be used inside the cache. |
391 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { | 387 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { |
392 // Strip out the reference, username, and password sections of the URL. | 388 // Strip out the reference, username, and password sections of the URL. |
393 std::string url = HttpUtil::SpecForRequest(request->url); | 389 std::string url = HttpUtil::SpecForRequest(request->url); |
394 | 390 |
395 DCHECK(mode_ != DISABLE); | 391 DCHECK(mode_ != DISABLE); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 item->NotifyTransaction(ERR_CACHE_RACE, NULL); | 904 item->NotifyTransaction(ERR_CACHE_RACE, NULL); |
909 fail_requests = true; | 905 fail_requests = true; |
910 } else { | 906 } else { |
911 item->NotifyTransaction(result, entry); | 907 item->NotifyTransaction(result, entry); |
912 } | 908 } |
913 } | 909 } |
914 } | 910 } |
915 } | 911 } |
916 | 912 |
917 } // namespace net | 913 } // namespace net |
OLD | NEW |