| 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 } | 919 } |
| 920 | 920 |
| 921 return false; | 921 return false; |
| 922 } | 922 } |
| 923 | 923 |
| 924 void URLRequestHttpJob::StopCaching() { | 924 void URLRequestHttpJob::StopCaching() { |
| 925 if (transaction_.get()) | 925 if (transaction_.get()) |
| 926 transaction_->StopCaching(); | 926 transaction_->StopCaching(); |
| 927 } | 927 } |
| 928 | 928 |
| 929 std::string URLRequestHttpJob::GetSocketAddress() const { |
| 930 return response_info_ ? response_info_->socket_address : ""; |
| 931 } |
| 932 |
| 929 URLRequestHttpJob::~URLRequestHttpJob() { | 933 URLRequestHttpJob::~URLRequestHttpJob() { |
| 930 DCHECK(!sdch_test_control_ || !sdch_test_activated_); | 934 DCHECK(!sdch_test_control_ || !sdch_test_activated_); |
| 931 if (!IsCachedContent()) { | 935 if (!IsCachedContent()) { |
| 932 if (sdch_test_control_) | 936 if (sdch_test_control_) |
| 933 RecordPacketStats(SDCH_EXPERIMENT_HOLDBACK); | 937 RecordPacketStats(SDCH_EXPERIMENT_HOLDBACK); |
| 934 if (sdch_test_activated_) | 938 if (sdch_test_activated_) |
| 935 RecordPacketStats(SDCH_EXPERIMENT_DECODE); | 939 RecordPacketStats(SDCH_EXPERIMENT_DECODE); |
| 936 } | 940 } |
| 937 // Make sure SDCH filters are told to emit histogram data while this class | 941 // Make sure SDCH filters are told to emit histogram data while this class |
| 938 // can still service the IsCachedContent() call. | 942 // can still service the IsCachedContent() call. |
| 939 DestroyFilters(); | 943 DestroyFilters(); |
| 940 | 944 |
| 941 if (sdch_dictionary_url_.is_valid()) { | 945 if (sdch_dictionary_url_.is_valid()) { |
| 942 // Prior to reaching the destructor, request_ has been set to a NULL | 946 // Prior to reaching the destructor, request_ has been set to a NULL |
| 943 // pointer, so request_->url() is no longer valid in the destructor, and we | 947 // pointer, so request_->url() is no longer valid in the destructor, and we |
| 944 // use an alternate copy |request_info_.url|. | 948 // use an alternate copy |request_info_.url|. |
| 945 SdchManager* manager = SdchManager::Global(); | 949 SdchManager* manager = SdchManager::Global(); |
| 946 // To be extra safe, since this is a "different time" from when we decided | 950 // To be extra safe, since this is a "different time" from when we decided |
| 947 // to get the dictionary, we'll validate that an SdchManager is available. | 951 // to get the dictionary, we'll validate that an SdchManager is available. |
| 948 // At shutdown time, care is taken to be sure that we don't delete this | 952 // At shutdown time, care is taken to be sure that we don't delete this |
| 949 // globally useful instance "too soon," so this check is just defensive | 953 // globally useful instance "too soon," so this check is just defensive |
| 950 // coding to assure that IF the system is shutting down, we don't have any | 954 // coding to assure that IF the system is shutting down, we don't have any |
| 951 // problem if the manager was deleted ahead of time. | 955 // problem if the manager was deleted ahead of time. |
| 952 if (manager) // Defensive programming. | 956 if (manager) // Defensive programming. |
| 953 manager->FetchDictionary(request_info_.url, sdch_dictionary_url_); | 957 manager->FetchDictionary(request_info_.url, sdch_dictionary_url_); |
| 954 } | 958 } |
| 955 } | 959 } |
| 956 | 960 |
| 957 } // namespace net | 961 } // namespace net |
| OLD | NEW |