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