Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 ResourceLoader(std::unique_ptr<net::URLRequest> request, | 45 ResourceLoader(std::unique_ptr<net::URLRequest> request, |
| 46 std::unique_ptr<ResourceHandler> handler, | 46 std::unique_ptr<ResourceHandler> handler, |
| 47 CertStore* cert_store, | 47 CertStore* cert_store, |
| 48 ResourceLoaderDelegate* delegate); | 48 ResourceLoaderDelegate* delegate); |
| 49 ~ResourceLoader() override; | 49 ~ResourceLoader() override; |
| 50 | 50 |
| 51 void StartRequest(); | 51 void StartRequest(); |
| 52 void CancelRequest(bool from_renderer); | 52 void CancelRequest(bool from_renderer); |
| 53 | 53 |
| 54 bool is_transferring() const { return is_transferring_; } | 54 bool is_transferring() const { return is_transferring_; } |
| 55 void MarkAsTransferring(const scoped_refptr<ResourceResponse>& response); | 55 void MarkAsTransferring(const base::Closure& on_transfer_complete_callback); |
| 56 void CompleteTransfer(); | 56 void CompleteTransfer(); |
| 57 | 57 |
| 58 net::URLRequest* request() { return request_.get(); } | 58 net::URLRequest* request() { return request_.get(); } |
| 59 ResourceRequestInfoImpl* GetRequestInfo(); | 59 ResourceRequestInfoImpl* GetRequestInfo(); |
| 60 | 60 |
| 61 void ClearLoginDelegate(); | 61 void ClearLoginDelegate(); |
| 62 | 62 |
| 63 // Returns a pointer to the ResourceResponse for a request that is | 63 // Returns a pointer to the ResourceResponse for the request. |
| 64 // being transferred to a new consumer. The response is valid between | 64 ResourceResponse* response() { return response_.get(); } |
| 65 // the time that the request is marked as transferring via | |
| 66 // MarkAsTransferring() and the time that the transfer is completed | |
| 67 // via CompleteTransfer(). | |
| 68 ResourceResponse* transferring_response() { | |
| 69 return transferring_response_.get(); | |
| 70 } | |
| 71 | 65 |
| 72 private: | 66 private: |
| 73 // net::URLRequest::Delegate implementation: | 67 // net::URLRequest::Delegate implementation: |
| 74 void OnReceivedRedirect(net::URLRequest* request, | 68 void OnReceivedRedirect(net::URLRequest* request, |
| 75 const net::RedirectInfo& redirect_info, | 69 const net::RedirectInfo& redirect_info, |
| 76 bool* defer) override; | 70 bool* defer) override; |
| 77 void OnAuthRequired(net::URLRequest* request, | 71 void OnAuthRequired(net::URLRequest* request, |
| 78 net::AuthChallengeInfo* info) override; | 72 net::AuthChallengeInfo* info) override; |
| 79 void OnCertificateRequested(net::URLRequest* request, | 73 void OnCertificateRequested(net::URLRequest* request, |
| 80 net::SSLCertRequestInfo* info) override; | 74 net::SSLCertRequestInfo* info) override; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; | 135 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; |
| 142 std::unique_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; | 136 std::unique_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; |
| 143 | 137 |
| 144 base::TimeTicks read_deferral_start_time_; | 138 base::TimeTicks read_deferral_start_time_; |
| 145 | 139 |
| 146 // Indicates that we are in a state of being transferred to a new downstream | 140 // Indicates that we are in a state of being transferred to a new downstream |
| 147 // consumer. We are waiting for a notification to complete the transfer, at | 141 // consumer. We are waiting for a notification to complete the transfer, at |
| 148 // which point we'll receive a new ResourceHandler. | 142 // which point we'll receive a new ResourceHandler. |
| 149 bool is_transferring_; | 143 bool is_transferring_; |
| 150 | 144 |
| 151 // Holds the ResourceResponse for a request that is being transferred | 145 scoped_refptr<ResourceResponse> response_; |
|
nasko
2016/09/08 23:45:39
Can we have a comment on this member? Especially s
clamy
2016/09/09 15:06:41
This object is no longer there since jam's patch r
nasko
2016/09/09 23:30:27
Acknowledged.
| |
| 152 // to a new consumer. This member is populated when the request is | 146 |
| 153 // marked as transferring via MarkAsTransferring(), and it is cleared | 147 // Called when a navigation has finished transfer. |
| 154 // when the transfer is completed via CompleteTransfer(). | 148 base::Closure on_transfer_complete_; |
| 155 scoped_refptr<ResourceResponse> transferring_response_; | |
| 156 | 149 |
| 157 // Instrumentation add to investigate http://crbug.com/503306. | 150 // Instrumentation add to investigate http://crbug.com/503306. |
| 158 // TODO(mmenke): Remove once bug is fixed. | 151 // TODO(mmenke): Remove once bug is fixed. |
| 159 int times_cancelled_before_request_start_; | 152 int times_cancelled_before_request_start_; |
| 160 bool started_request_; | 153 bool started_request_; |
| 161 int times_cancelled_after_request_start_; | 154 int times_cancelled_after_request_start_; |
| 162 | 155 |
| 163 // Allows tests to use a mock CertStore. The CertStore must outlive | 156 // Allows tests to use a mock CertStore. The CertStore must outlive |
| 164 // the ResourceLoader. | 157 // the ResourceLoader. |
| 165 CertStore* cert_store_; | 158 CertStore* cert_store_; |
| 166 | 159 |
| 167 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 160 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
| 168 | 161 |
| 169 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 162 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 170 }; | 163 }; |
| 171 | 164 |
| 172 } // namespace content | 165 } // namespace content |
| 173 | 166 |
| 174 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 167 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| OLD | NEW |