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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 ResourceLoader(std::unique_ptr<net::URLRequest> request, | 44 ResourceLoader(std::unique_ptr<net::URLRequest> request, |
45 std::unique_ptr<ResourceHandler> handler, | 45 std::unique_ptr<ResourceHandler> handler, |
46 ResourceLoaderDelegate* delegate); | 46 ResourceLoaderDelegate* delegate); |
47 ~ResourceLoader() override; | 47 ~ResourceLoader() override; |
48 | 48 |
49 void StartRequest(); | 49 void StartRequest(); |
50 void CancelRequest(bool from_renderer); | 50 void CancelRequest(bool from_renderer); |
51 | 51 |
52 bool is_transferring() const { return is_transferring_; } | 52 bool is_transferring() const { return is_transferring_; } |
53 void MarkAsTransferring(const scoped_refptr<ResourceResponse>& response); | 53 void MarkAsTransferring(const base::Closure& on_transfer_complete_callback); |
54 void CompleteTransfer(); | 54 void CompleteTransfer(); |
55 | 55 |
56 net::URLRequest* request() { return request_.get(); } | 56 net::URLRequest* request() { return request_.get(); } |
57 ResourceRequestInfoImpl* GetRequestInfo(); | 57 ResourceRequestInfoImpl* GetRequestInfo(); |
58 | 58 |
59 void ClearLoginDelegate(); | 59 void ClearLoginDelegate(); |
60 | 60 |
61 private: | 61 private: |
62 // net::URLRequest::Delegate implementation: | 62 // net::URLRequest::Delegate implementation: |
63 void OnReceivedRedirect(net::URLRequest* request, | 63 void OnReceivedRedirect(net::URLRequest* request, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; | 130 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; |
131 std::unique_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; | 131 std::unique_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; |
132 | 132 |
133 base::TimeTicks read_deferral_start_time_; | 133 base::TimeTicks read_deferral_start_time_; |
134 | 134 |
135 // Indicates that we are in a state of being transferred to a new downstream | 135 // Indicates that we are in a state of being transferred to a new downstream |
136 // consumer. We are waiting for a notification to complete the transfer, at | 136 // consumer. We are waiting for a notification to complete the transfer, at |
137 // which point we'll receive a new ResourceHandler. | 137 // which point we'll receive a new ResourceHandler. |
138 bool is_transferring_; | 138 bool is_transferring_; |
139 | 139 |
| 140 // Called when a navigation has finished transfer. |
| 141 base::Closure on_transfer_complete_; |
| 142 |
140 // Instrumentation add to investigate http://crbug.com/503306. | 143 // Instrumentation add to investigate http://crbug.com/503306. |
141 // TODO(mmenke): Remove once bug is fixed. | 144 // TODO(mmenke): Remove once bug is fixed. |
142 int times_cancelled_before_request_start_; | 145 int times_cancelled_before_request_start_; |
143 bool started_request_; | 146 bool started_request_; |
144 int times_cancelled_after_request_start_; | 147 int times_cancelled_after_request_start_; |
145 | 148 |
146 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 149 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
147 | 150 |
148 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 151 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
149 }; | 152 }; |
150 | 153 |
151 } // namespace content | 154 } // namespace content |
152 | 155 |
153 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 156 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
OLD | NEW |